Open Serkan80 opened 6 months ago
/cc @cescoffier (reactive-messaging), @ozangunalp (reactive-messaging)
@Serkan80 you can, just emit an MqttMessage and leave the topic of the channel undefined:
import org.eclipse.microprofile.reactive.messaging.Channel;
import org.eclipse.microprofile.reactive.messaging.Emitter;
import org.eclipse.microprofile.reactive.messaging.Incoming;
import io.smallrye.reactive.messaging.mqtt.MqttMessage;
...
@Inject
@Channel(SEND_CHANNEL)
Emitter<String> emitter;
String topic = ...
MqttMessage<String> message = MqttMessage.of(topic, payload);
emitter.send(message);
Description
Currently, afaik, it is not possible to send messages to topics/queues which have not been configured beforehand in applications.properties.
Especially in MQTT environment, it is common to create topics on the fly and subscribe to them.
Implementation ideas
An idea would be to do something like this: