The CloudCat Service replicates messages published to one CloudService instance to another one, performing the following operations:
- The service obtains two CloudClients from two different CloudService instances specified in the service configuration.
- For each CloudClient, the service subscribes to a set of topics specified in the configuration.
- Message received by the service on one of the two CloudClients will be re-published on the other one.
This service allows for example to share an existing cloud connection to external applications using the Artemis broker. An example of this use case will be presented below.
In order to create an instance of the CloudCat component perform the following steps:
- Press the + button under Services in the ESF Web UI.
org.eclipse.kura.misc.cloudcat.CloudCatfrom the Factory drop down list.
- Enter an unique name for the new instance in the Name field and press Apply.
In order to review the configuration of a CloudCat instance, click on the corresponding entry under Services:
The following configuration options are available:
- Relay Enable: Enables or disables the CloudCat instance
- First/Second Cloud Service PID: These properties specify the Kura Service Pid of the CloudService instances to be used.
- First/Second CloudClient App ID: The application ID to be used by the CloudCat service on each cloud service.
- First/Second CloudClient Control Subscriptions: A list of control topics to subscribe to on on each CloudClient as a comma separated list of
- First/Second CloudClient Control Subscriptions: A list of data topics to subscribe to on each CloudClient as a comma separated list of
The CloudCat service will replicate all messages received on each of the control or data topics specified in the configuration to the other CloudClient, the complete topics will have the following structure
- Data Topics:
- Control Topics:
#account-nameis the value of the topic.context.account-name configuration property of the MQTTDataTransport instance in use.
#client-idis the value of the client-id configuration property of the MQTTDataTransport instance in use, if this parameter is empty, the MAC address of the primary network interface of the device will be used.
#control-topic-prefixif the value of the topic.control-prefix configuration property of the CloudService instance in use.
#control-app-topicare obtained from the CloudCat configuration as described above.
When a CloudCat instance forwards a message from one CloudClient to another, only the
#control-app-topic part of the topic is preserved, the remaining parts are translated to match the configuration of the CloudService on which the messages are published.
Note: The set of topics specified for data or control topic subscriptions on each CloudService instance should be disjoint. If this condition is not verified, and a CloudCat instances is subscribed to a same topic on each CloudService instance, message loops may occur.
- Connect the default CloudService instance to your favourite cloud platform.
- Enable the Simple Artemis MQTT Broker service by configuring it as follows:
- MQTT address:
- MQTT port:
- User name:
- Password of the user:
foo(or any other password)
- Open the MQTT port specified above in the firewall configuration.
- Navigate to the Cloud Services section of the Web UI
- Click on the New button and create a new CloudService instance with the
org.eclipse.kura.cloud.CloudService-ARTEMISCloud Service PID.
- Configure the new instance as follows:
- MqttDataTransport-ARTEMIS -> broker-url:
- MqttDataTransport-ARTEMIS -> topic.context.account-name:
- MqttDataTransport-ARTEMIS -> username:
- MqttDataTransport-ARTEMIS -> password:
foo, (or any other password used at step 2)
- MqttDataTransport-ARTEMIS -> client-id:
- CloudService-ARTEMIS -> encode.gzip:
- CloudService-ARTEMIS -> enable.default.subscriptions:
- CloudService-ARTEMIS -> birth.cert.policy:
- CloudService-ARTEMIS -> payload.encoding:
- DataService-ARTEMIS -> connect.auto-on-startup:
- Create a new CloudCat instance as shown above.
- Configure the instance as follows:
- Relay Enable:
- First CloudService PID:
- Second CloudService PID:
- First CloudClient App ID:
- Second CloudClient App ID:
- First CloudClient Control Subscriptions: leave blank
- Second CloudClient Control Subscriptions: leave blank
- First CloudClient Data Subscriptions:
- Second CloudClient Data Subscriptions:
Create an HTML file containing the following code:
HOST constant in the code by replacing
gateway-ip with the IP address of the gateway in use, and then open the created file in a browser.
artemis/cloudcat-relay/external-app/in topic and publishes messages to
The topics above are mapped to the following topics on the device cloud connection by the CloudCat service:
#client-id are the identifiers used on the cloud platform.
Messages published by the application can be viewed by using the Web console of the cloud platform used under the
Messages published on the
#account-name/#client-id/cloudcat/in topic on the cloud platform will be received by the CloudCat and then forwarded to the external application that will log them on the browser window.
Updated over 1 year ago