Search code examples
eclipse-honoeclipse-dittoeclipse-ioteclipse-digital-twin

Connecting Eclipse Hono and Ditto


I have eclipse-hono installed in one machine and Eclipse ditto installed in the other which is connected to same WIFI. I am trying to consume data from Eclipse hono to Eclipse ditto.

I have created a tenant named tenantallAdapters and registered a device named 4716.

Let us assume that I need to send the temperature sensor data from the registered device in the tenant to a Hono consumer as shown in the below snippet.

curl -i -X POST \
-u sensor10@tenantAllAdapters \
-H 'Content-Type: application/json' \
--data-binary '{"temp": 5}' \
http://10.196.2.164:8080/telemetry

I also start the Hono-consumer as below

mvn spring-boot:run -Drun.arguments=\
--hono.client.host=10.196.2.164,\
--hono.client.username=consumer@HONO,\
--hono.client.password=verysecret,\
--hono.auth.amqp.bindAddress=10.196.2.164,\
--hono.auth.amqp.keyPath=target/certs/auth-server-key.pem,\
--hono.auth.amqp.certPath=target/certs/auth-server-cert.pem,\
--hono.auth.amqp.trustStorePath=target/certs/trusted-certs.pem,\
--tenant.id=tenantAllAdapters

I am successfully able to receive the data in Hono consumer.

Instead of Hono consumer, how can I consume the same data in Ditto?

Edited : As per the blog in the first comment below:

“Test connection” command via HTTP in order to test if the Ditto sandbox can connect to the Hono one is as follows

$ curl -X POST -i -u devops:devopsPw1! -H 'Content-Type: application/json' -d '{
"targetActorSelection": "/system/sharding/connection",
"headers": {
    "aggregate": false
},
"piggybackCommand": {
    "type": "connectivity.commands:testConnection",
    "connection": {
        "id": "hono-sandbox-connection-1",
        "connectionType": "amqp-10",
        "connectionStatus": "open",
        "uri": "amqp://consumer%40HONO:[email protected]:15672",
        "failoverEnabled": true,
        "sources": [{
            "addresses": [
                "telemetry/org.eclipse.ditto",
                "event/org.eclipse.ditto"
            ],
            "authorizationContext": ["nginx:demo5"]
        }]
    }
}
}' https://ditto.eclipse.org/devops/piggyback/connectivity?timeout=8000

I am not sure if I am missing anything


Solution

  • I had followed https://www.eclipse.org/ditto/2018-05-02-connecting-ditto-hono.html even before I posted this question here.

    But the only thing I was missing was the password of the devops user. As mentioned earlier and also as mentioned in the given link, I was using devopsPw1! as the password. Hono and Ditto got connected once I changed the password to foobar.