def on_start(self, event):
event.container: Container
conn = event.container.connect(url=self.server, user="consumer@HONO", password="verysecret")
event.container.create_receiver(conn, f"telemetry/{self.tenant}")
self.sender = event.container.create_sender(conn, target=f"command/{self.tenant}", options=[HelloWorld.SessionEnd()])
def on_message(self, event):
print(f"I got a telemetry message, sending command...")
self.accept(event.delivery)
message = Message(properties={
"to": f"command/{self.tenant}/{self.deviceId}",
"subject": "work",
# "content-type": "application/json",
# "messageId": "0",
# "userId": "null",
# "replyTo": "null",
# "correlationId": "0",
# "contentEncoding": "null",
# "absoluteExpiryTime": "null",
# "creationTime": "null",
# "groupId": 'null',
# "groupSequence": "null",
# "replyToGroupId": 'null',
})
print(f"Sending Command: {message}")
self.sender.send(message)
from __future__ import print_function, unicode_literals
from proton import Message
from proton.handlers import MessagingHandler
from proton.reactor import Container
class HelloWorld(MessagingHandler):
def __init__(self, server, address):
super(HelloWorld, self).__init__()
self.server = server
self.address = address
def on_start(self, event):
print("connecting ...")
conn = event.container.connect(self.server, sasl_enabled=True, allowed_mechs="PLAIN", allow_insecure_mechs=True, user="consumer@HONO", password="verysecret")
event.container.create_sender(conn, self.address)
def on_sendable(self, event):
print("sending command")
event.sender.send(Message(body="Hello World!", address="command/DEFAULT_TENANT/4711", content_type="text/plain", subject="call"))
event.sender.close()
event.connection.close()
Container(HelloWorld("amqp://hono.eclipseprojects.io:15672", "command/DEFAULT_TENANT")).run()
properties
dict with keys to
and subject
but it seems that qpid wants it as separate properties address
and subject
directly (see here: https://qpid.apache.org/releases/qpid-proton-0.32.0/proton/python/docs/proton.html#proton.Message)
ttd
set
QuarkusMqttProtocolAdapterProperties
but couldn't find where this was populated. Do I have to provide the configuration in a different way for these quarkus containers?