|
|
# Introduction
|
|
|
Controlling the Cameo apps is already a form of communication between the apps. We show here the common ways to make them communicate by using the communication patterns aka coms and the return value.
|
|
|
Controlling the CAMEO apps is already a form of communication between the apps. We show here the common ways to make them communicate by using the communication patterns aka coms and the return value.
|
|
|
|
|
|
The following examples will only show string messages however any kind of serialization can be used: binary serialization with *Protobuf* or ascii serialization with *JSON*.
|
|
|
|
... | ... | @@ -13,7 +13,7 @@ public class JavaApp { |
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
// Initialize the Cameo application represented by This.
|
|
|
// Initialize the CAMEO application represented by This.
|
|
|
This.init(args);
|
|
|
|
|
|
// Infinite printing loop.
|
... | ... | @@ -43,7 +43,7 @@ In C++, we can get the string result: |
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
// Define the reference to the Cameo server in B.
|
|
|
// Define the reference to the CAMEO server in B.
|
|
|
std::unique_ptr<cameo::Server> server = cameo::Server::create("tcp://B:7000");
|
|
|
|
|
|
// Start the application "App2" and obtain a reference to the running app.
|
... | ... | @@ -77,7 +77,7 @@ Indeed in that case it is better to setup a requester/responder communication to |
|
|
|
|
|
If you need to setup a request/response mechanism between different apps then use the provided requester/responder communication pattern.
|
|
|
|
|
|
An example of a responder in a C++ application registered as *ResApp* in the Cameo server:
|
|
|
An example of a responder in a C++ application registered as *ResApp* in the CAMEO server:
|
|
|
```cpp
|
|
|
try {
|
|
|
// Create the basic responder with name "the-responder".
|
... | ... | @@ -312,6 +312,6 @@ except cameopy.InitException: |
|
|
print("Subscriber error")
|
|
|
```
|
|
|
|
|
|
As for the requester/responder no port was provided to define the publisher and subscriber. but only a name. Moreover the Cameo implementation provides a bit of **synchronization** with the number of subscribers which can be very useful.
|
|
|
As for the requester/responder no port was provided to define the publisher and subscriber. but only a name. Moreover the CAMEO implementation provides a bit of **synchronization** with the number of subscribers which can be very useful.
|
|
|
|
|
|
The communication patterns provided by Cameo are **high-level** and allow programmers to rapidly design a communication between apps. |
|
|
The communication patterns provided by CAMEO are **high-level** and allow programmers to rapidly design a communication between apps. |