Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Problem with XMPP/RemoteServiceListener and OpenFire 3.7.1

Oops, I missed the end of the message. Here is the end of my message :

When the OpenFire is version 3.6.4, the message "Handle service event 2"
display to the console. When the OpenFire is version 3.7.1, the message
does not display. The event is not received.

Do I use the remote services the right way ? Is something changed in
OpenFire ?

Thanks
Guillaume




On Mon, 2012-06-25 at 11:22 +0200, Guillaume PRIN wrote:
> Hi,
> 
> I'm experiencing problems to update my OpenFire from 3.6.4 to 3.7.1.
> When a user register a remote service, the IRemoteServiceEvent is not
> received. This works like a charm with OpenFire 3.6.4.
> 
> I'm using ECF 3.5.1.v20110531-2218 with Eclipse Indigo in a RCP
> application. I'm running java 1.6.0_26 on ubuntu linux.
> OpenFire servers running on ubuntu linux with java 1.6.0_26.
> 
> I join a simple test case. I have a RCP with 3 buttons, which call the 3
> methods. 
> 
> connect1() : connect a client1 with the XMPP server.
> connect2() : connect a client2 with the XMPP server and add a Remote
> Service Listener .
> publishService1() : client1 publish a service to client2
> 
> When the OpenFire used is at verison 3.6.4
> 
> 
> Here is the code :
> 
> String client1 = "client1@openfire364";
> String client2 = "client1@openfire364";
> String pwd1 = "bot";
> String pwd2 = "bot";
> 
> private IRemoteServiceContainerAdapter service1;
> private ID id1;
> 
> private void connect1() throws Exception
> {
>     // CLIENT 1
>     System.out.println("Connect 1");
>     IContainer container1 = ContainerFactory.getDefault().
>             createContainer("ecf.xmpp.smack");
> 
>     id1 = IDFactory.getDefault().createID("ecf.xmpp", client1);
>     IConnectContext connectContext1 = ConnectContextFactory
>             .createPasswordConnectContext(pwd1);
>     container1.connect(id1, connectContext1);
>     service1 = (IRemoteServiceContainerAdapter) container1
>             .getAdapter(IRemoteServiceContainerAdapter.class);
> 
>     System.out.println("Connected 1");
> }
> 
> private void connect2() throws Exception
> {
>     // CLIENT 2
>     System.out.println("Connect 2");
>     IContainer container2 = ContainerFactory.getDefault().
>             createContainer("ecf.xmpp.smack");
> 
>     ID id2 = IDFactory.getDefault().createID("ecf.xmpp", client2);
>     IConnectContext connectContext2 = ConnectContextFactory
>             .createPasswordConnectContext(pwd2);
>     container2.connect(id2, connectContext2);
>     IRemoteServiceContainerAdapter service2 =
> (IRemoteServiceContainerAdapter) 
>             container2.getAdapter(IRemoteServiceContainerAdapter.class);
> 
>     service2.addRemoteServiceListener(new IRemoteServiceListener()
>     {
>         @Override
>         public void handleServiceEvent(IRemoteServiceEvent arg0)
>         {
>             System.out.println("Handle service event 2 "
>                     + arg0.getLocalContainerID() + " "
>                     + arg0.getContainerID());
> 
>         }
>     });
>     System.out.println("Connected 2");
> }
> 
> private void publishService1()
> {
>     ID id2 = IDFactory.getDefault().createID("ecf.xmpp", client2);
> 
>     Properties props = new Properties();
>     props.put(Constants.SERVICE_CONTAINER_ID, id1.getName());
>     ID[] targetIds = new ID[] { id2 };
>     props.put(Constants.SERVICE_REGISTRATION_TARGETS, targetIds);
>     props.put(Constants.SERVICE_REGISTER_PROXY, "true"); //$NON-NLS-1$
> 
>     IConcat serviceImpl = new IConcat()
>     {
>         @Override
>         public String concat(String first, String second)
>         {
>             return first + second;
>         }
>     };
> 
>     IRemoteServiceRegistration serviceReg =
> service1.registerRemoteService(
>             new String[] { IConcat.class.getName() }, serviceImpl,
> props);
>     System.out.println("Active = " +
> serviceReg.getReference().isActive());
> }
> 
> 
> 
> 




Back to the top