... | ... | @@ -129,49 +129,59 @@ The console *cmo* application is executing *requester-python* on *computer-a* wh |
|
|
|
|
|
## Java
|
|
|
|
|
|
The publisher/subscriber in Java can be tested. First start the Cameo server:
|
|
|
The publisher/subscriber in Java can be tested.
|
|
|
Start the publisher app in a new shell:
|
|
|
```
|
|
|
$ java fr.ill.ics.cameo.server.Server examples/java/config.xml --log-console
|
|
|
$ cmo -p 11000 exec publisher-java
|
|
|
```
|
|
|
Then start the publisher in a new shell:
|
|
|
Execute the subscriber app in a new shell:
|
|
|
```
|
|
|
$ cmo -p 10000 exec publisher
|
|
|
```
|
|
|
Execute a subscriber in a new shell:
|
|
|
```
|
|
|
$ cmo -p 10000 exec subscriber
|
|
|
$ cmo -p 11000 exec subscriber-java tcp://localhost:11000 java
|
|
|
```
|
|
|
|
|
|
The publisher app is waiting for 1 subscriber before starting to send messages.
|
|
|
The subscriber app connects to the publisher app which triggers the sending of the messages.
|
|
|
The subscriber app is killed with CTL-C but the publisher app is still running so that you have to kill it also with CTL-C.
|
|
|
|
|
|
Now relaunch the subscriber app without relaunching the publisher app. The publisher is started in background and the messages are sent from the publisher to the requester.
|
|
|
If you kill the subscriber app with CTL-C then the publisher is also killed. That is because the publisher app is linked to its starter.
|
|
|
|
|
|
Code is available:
|
|
|
* [Publisher java](https://code.ill.fr/cameo/cameo/-/blob/master/examples/java/src/fr/ill/ics/cameo/examples/PublisherApp.java)
|
|
|
* [Subscriber java](https://code.ill.fr/cameo/cameo/-/blob/master/examples/java/src/fr/ill/ics/cameo/examples/SubscriberApp.java)
|
|
|
|
|
|
|
|
|
## C++
|
|
|
|
|
|
The publisher/subscriber in C++ can be tested. First start the Cameo server:
|
|
|
```
|
|
|
$ java fr.ill.ics.cameo.server.Server examples/cpp/config.xml --log-console
|
|
|
```
|
|
|
Then start the publisher in a new shell:
|
|
|
```
|
|
|
$ cmo -p 10000 exec publisher
|
|
|
The publisher/subscriber in C++ can be tested in the same way by replacing *java* with *cpp*.
|
|
|
Start the publisher in a shell:
|
|
|
```
|
|
|
Execute a subscriber in a new shell:
|
|
|
$ cmo -p 11000 exec publisher-cpp
|
|
|
```
|
|
|
$ cmo -p 10000 exec subscriber
|
|
|
Execute the subscriber app in a new shell:
|
|
|
```
|
|
|
Execute the requester with the Java publisher:
|
|
|
```
|
|
|
$ cmo -p 10000 exec subscriber tcp://localhost:10000
|
|
|
$ cmo -p 11000 exec subscriber-cpp tcp://localhost:11000 cpp
|
|
|
```
|
|
|
Same comments as for Java.
|
|
|
|
|
|
Code is available:
|
|
|
* [Publisher cpp](https://code.ill.fr/cameo/cameo/-/blob/master/examples/cpp/src/PublisherApp.cpp)
|
|
|
* [Subscriber cpp](https://code.ill.fr/cameo/cameo/-/blob/master/examples/cpp/src/SubscriberApp.cpp)
|
|
|
|
|
|
|
|
|
## Python
|
|
|
|
|
|
First start the Cameo server:
|
|
|
The publisher/subscriber in Python can be tested in the same way by replacing *java* with *python*.
|
|
|
Start the publisher in a shell:
|
|
|
```
|
|
|
$ java fr.ill.ics.cameo.server.Server examples/python/config.xml --log-console
|
|
|
$ cmo -p 11000 exec publisher-python
|
|
|
```
|
|
|
In a shell, start the *publisherpy* test:
|
|
|
Execute the subscriber app in a new shell:
|
|
|
```
|
|
|
$ cmo -p 10000 exec publisherpy
|
|
|
$ cmo -p 11000 exec subscriber-python tcp://localhost:11000 python
|
|
|
```
|
|
|
In a shell, start the *subscriberpy* application:
|
|
|
```
|
|
|
$ cmo -p 10000 exec subscriberpy
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
Same comments as for Java.
|
|
|
|
|
|
Code is available:
|
|
|
* [Publisher python](https://code.ill.fr/cameo/cameo/-/blob/master/examples/python/src/publisherapp.py)
|
|
|
* [Subscriber python](https://code.ill.fr/cameo/cameo/-/blob/master/examples/python/src/subscriberapp.py) |