GH-3340: IntegrationEvents - add getSourceAsType()

Resolves https://github.com/spring-projects/spring-integration/issues/3340

- add common super-interface for MQTT components
- add `getConnectionInfo()` so users can examine server URIs etc

* Reinstate per-adapter URIs - support multiple

* Restore single URL per adapter.

* Code cleanup for previous commit.
This commit is contained in:
Gary Russell
2020-07-21 16:29:23 -04:00
committed by GitHub
parent 5be0ed17eb
commit 40b0031e0f
12 changed files with 243 additions and 21 deletions

View File

@@ -403,3 +403,14 @@ Certain application events are published by the adapters.
* `MqttSubscribedEvent` - published by the inbound adapter after subscribing to the topics.
These events can be received by an `ApplicationListener<MqttIntegrationEvent>` or with an `@EventListener` method.
To determine the source of an event, use the following; you can check the bean name and/or the connect options (to access the server URIs etc).
====
[source, java]
----
MqttPahoComponent source = event.getSourceAsType();
String beanName = source.getBeanName();
MqttConnectOptions options = source.getConnectionInfo();
----
====