Where can I find a working example of how to remotely invoke the OSGi service contained in Eclipse Virgo?

Can someone point to a step-by-step guide on how to configure the remote service contained in Eclipse Virgo 3.0x? I know that standards exist, etc., but I can’t find a NO example that does not seem to contain a bunch of manual scope, and not specific steps along with working code / configurations to load. I don't care if the example uses Apache CXF, Eclipse ECF or something else. I want the RMI equivalent to be that both the transport and the wired protocol abstract from what seems to developers both on the client side and on the server side, as in plain Java (with some free actions).

What packages should be deployed in Virgo to support remote access? What Spring -ish configuration settings work? Which banks should be in the client class? Etc etc.?

+4
source share
2 answers

I played with Apache CXF DOSGI and worked easily with it.

  • Download the CXF distribution from one package from here - I used 1.3.0.
  • Unzip Virgo (I used the kernel distribution for simplicity), copy the CXF package to the pickup and run Virgo:

    $ bin/startup.sh [2012-04-04 14:17:33.011] startup-tracker <KE0001I> Kernel starting. [2012-04-04 14:17:36.135] startup-tracker <KE0002I> Kernel started. ... [2012-04-04 14:17:38.561] sync Event Dispatcher Thread <UR0001I> User region ready. [2012-04-04 14:17:39.565] fs-watcher <HD0001I> Hot deployer processing 'INITIAL' event for file 'cxf-dosgi-ri-singlebundle-distribution-1.3.jar'. [2012-04-04 14:17:40.060] fs-watcher <DE0000I> Installing bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'. [2012-04-04 14:17:40.570] fs-watcher <DE0001I> Installed bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'. [2012-04-04 14:17:40.593] fs-watcher <DE0004I> Starting bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'. [2012-04-04 14:17:43.498] start-signalling-1 <DE0005I> Started bundle 'cxf-dosgi-ri-singlebundle-distribution' version '1.3.0'. 
  • Install and start the ZooKeeper server in accordance with these instructions - I used 3.4.3. See also ZooKeeper instructions , including how to create a configuration file.

  • Create an org.apache.cxf.dosgi.discovery.zookeeper.properties file containing:

     zookeeper.host = 127.0.0.1 

    and copy the pickup:

     [2012-04-04 14:29:51.385] fs-watcher <HD0001I> Hot deployer processing 'CREATED' event for file 'org.apache.cxf.dosgi.discovery.zookeeper.properties'. [2012-04-04 14:29:51.417] fs-watcher <DE0000I> Installing configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'. [2012-04-04 14:29:51.428] fs-watcher <DE0001I> Installed configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'. [2012-04-04 14:29:51.434] fs-watcher <DE0004I> Starting configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'. [2012-04-04 14:29:51.439] fs-watcher <DE0005I> Started configuration 'org.apache.cxf.dosgi.discovery.zookeeper' version '0.0.0'. 
  • Unzip another copy of the Virgo kernel, copy the CXF package and org.apache.cxf.dosgi.discovery.zookeeper.properties into the pickup command and start from a different JMX port:

     $ bin/startup.sh -jmxport 9876 

    To do this, but to verify that it works, the rest of the steps run the greeter sample ...

  • Install / run the greeter interface and the implementation communicates with the first Virgo instance. The easiest way is to copy the interface package to the / usr repository, and then copy the implementation package to the pickup.

  • Install / run the greeter interface and client binds the second instance of Virgo. The easiest way is to copy the interface package to the / usr repository, and then copy the client package to the pickup.

  • When the "Invoke Remote Greeter Service" window appears, enter a string (for example, "foo") in the "Name" field and click "Call."

  • The first Virgo instance displays the following trace log messages (in serviceability / logs / log.log):

     Invoking: greetMe(foo) 
  • The second Virgo instance displays the following trace log messages:

     [2012-04-05 14:14:56.766] INFO Thread-29 System.out *** Invoking greeter *** [2012-04-05 14:14:56.970] INFO Thread-29 System.out greetMe("foo") returns: [2012-04-05 14:14:56.971] INFO Thread-29 System.out Hola foo [2012-04-05 14:14:56.971] INFO Thread-29 System.out Bonjour foo [2012-04-05 14:14:56.972] INFO Thread-29 System.out Hoi foo [2012-04-05 14:14:56.972] INFO Thread-29 System.out Hello foo [2012-04-05 14:14:56.972] INFO Thread-29 System.out *** Opening greeter client dialog *** 
  • Look in the services registry of the second Virgo instance.

     osgi> vsh:service examine 245 Properties: endpoint.id: http://localhost:9090/greeter objectClass: org.apache.cxf.dosgi.samples.greeter.GreeterService service.id: 245 service.imported: true service.imported.configs: org.apache.cxf.ws Publisher: cxf-dosgi-ri-singlebundle-distribution 1.3.0 [84] Consumer(s): cxf-dosgi-ri-samples-greeter-client 1.2.0 [86] 

    The remote GreeterService is published to the services registry.

+4
source

This is not exactly what you are looking for, but I have every reason to believe that the instructions in the Remote Services chapter in Enterprise OSGi in Action should work with Virgo.

+2
source

Source: https://habr.com/ru/post/1389848/


All Articles