Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] XMPP

Hi Scott.

I finally got the whole communication work. Here are a couple of questions that I have: for me to get things to work, I had to orchestrate the timing carefully; it seems that at the time that I am creating the adapter (for remote service) on the client side, it checks for the services that are exposed and not when it is trying to get the reference to the remote services. In other words, I need to make sure that the "server" has published the service for that client before creating the adapter on the client side. This restriction on timing is not very ideal since given the use case that I have, both client and server can come on line and go off line and again come back on line.

Another question I have is related to exposing services on the server side. With the XMPP Provider, I need to have the client's id's when I want to register my service on the server side. What if at the time that my server is doing that, some clients are not there yet and later on they show up, or even new clients get added? I can have a presence listener to catch any new client that joins in but is it okay if I have the registration adapter.registerRemoteService(new String[]{Myservice.class.getName()}, this, props); in my listener where the properties props has the ID of the new client that just showed up? In other words, is it ok to invoke the above line of code multiple times, once per each client, inside my presence listener. What is a better way to do that?

Finally, for adding an option to enable the auto-reconnect using Smack 3.1 library, I have opened this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=313028

Many thanks
ali.



On 5/15/2010 11:33 AM, Scott Lewis wrote:
Hi Ali,

Ali Naddaf wrote:
Thank you Scott. I have made some progress there and hopefully soon will have a complete working example that I can share in case you would be interested in posting that. I am sure I will have some questions on the way but one that I ran into is the following: if I make a connection (using container.connect(...)), and if I lose connectivity (due to network) and gain internet connectivity again, I will not be reconnected automatically. If I were to use the smack libraries directly to connect to a jabber server, it would reconnect automatically so is there an option there that I can enable this feature?

I don't think so, but since it's been quite a few months since I've examined the Smack autoreconnect API I'm not completely certain. For your reference, most of the Smack connection setup/handling code in the ECF provider (in bundle: org.eclipse.ecf.provider.xmpp) is in this class:

org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection

If not, what is the correct approach: should I register a listener and manually reconnect?

Yes, you can/could register a listener and reconnect. You will want to make sure that you do not reconnect in the same thread that calls the listener.

Another option would be to add a reconnect option to the XMPP provider (e.g. upon container creation) and then use the underlying Smack 3.1 autoreconnect (ECF moved to Smack 3.1 last fall). If you decide to do this (modify/enhance the provider: org.eclipse.ecf.provider.xmpp), please open an enhancement request to that effect. It's likely too late to get such a change into the provider for Helios, but it could be in (e.g.) a future release of ECF.

Thanks,

Scott




Thanks
Ali.

On 5/14/2010 10:16 PM, Scott Lewis wrote:
Hi Ali,

Ali Naddaf wrote:
Hello everyone.

I like to use the XMPP container of ECF to do the following: I have two separate instances of OSGi framework running on separate networks. I want to remotely call services of each framework from the other one using, say, Google's jabber server (gtalk). To that effect, I will create two gtalk accounts, one for each framework.

Right.


In the above scenario, do I still need to employ any discovery mechanism?

No, you don't.


If each framework knows about the other framework's jabber id, would that be adequate?

Yes.

Is there a sample code (example) or a test case for this? I see some xmpp examples in the ecf source repository but they are mostly (as far as I can see) concerned with sending a message not calling a remote service.

There is test code for the xmpp usage of remote services.  It's for
testing the ECF remote services API usage...rather than the OSGi remote
services (which is built upon ECF remote services), but it does give
some idea of how to do remote services using XMPP.  We currently don't
run these tests automatically, because we need to setup/run an xmpp
server consistently to be able to do so.   Hopefully we will be able to
do this soon (run an xmpp server consistently).

The test class is:

org.eclipse.ecf.tests.provider.xmpp.remoteservice.RemoteServiceTest

This is in this test plugin:  org.eclipse.ecf.tests.provider.xmpp

This plugin is in <ecf home>/tests/bundles in ECF CVS area.

Hope this helps.  Please keep informed about how this is going, and I
will provide as much support as possible.

Scott





_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top