Skip to content

Reactive Messaging: support dynamic emitters & publishers #40098

@Serkan80

Description

@Serkan80

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:

@Inject 
//@Broadcast --> should work
Emitter emitter;

@Inject 
//@Channel("/house/+/temperature") --> should work: listen to temperatures in all rooms 
Publisher publisher;

public void sendMessage(String topic, String payload) {
  this.emitter.send(topic, payload);
}

public void subscribe(String topic) {
  this.publisher.subscribe(topic, this::handleMessage);
}

public void unsubscribe(String topic) {
  this.publisher.unsubscribe(topic);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions