New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dependency registration for Messaging annotation parsers #8654
Comments
Starting with version Let us know if that works for you! |
I'm able to check the connection using the ClientManager, but I see a strange side-effect when publishing to Mqtt. Is there a way to manage the order in which the doStart methods are triggered? That way I can make sure the ClientManagers are started first. Or am I doing something wrong here? |
Well, according to my debugging it happens not the way you got it:
My config is just like this:
Since there is a dependency from the It would be great to know what is your configuration to determine why dependency lifecycle is not triggered in time.
The You may need to revise your publishing logic to not do that too early. Kinda let the whole application to be started before do your hard logic. |
Thanks for the answer. The workaround (putting phase of ClientManager to Integer.MIN_VALUE) works, now the ClientManagers are started first, before the MessageHandlers. These are the logs WITHOUT the workaround:
And here is the config:
|
OK. I see. So, the So, I'm treating this as a bug and will fix it soon. I'll repurpose your issue to respective bug since, essentially, your one has been just a question which we don't handle in issues. |
Fixes spring-projects#8654 Spring Framework has an ability to start dependant beans automatically when we start the current one. The `AbstractMethodAnnotationPostProcessor` is missing a bean dependency registration causing errors in target applications when Messaging Annotations configuration is used. * Add `registerDependentBean()` into an `AbstractMethodAnnotationPostProcessor` when we generate and register a `ConsumerEndpointFactoryBean` * Change one of the `ClientManagerBackToBackTests` configuration to rely on a `@ServiceActivator` for `Mqttv5PahoMessageHandler` bean to ensure that change in the `AbstractMethodAnnotationPostProcessor` has a proper effect **Cherry-pick to `6.1.x` & `6.0.x`**
Fixes #8654 Spring Framework has an ability to start dependant beans automatically when we start the current one. The `AbstractMethodAnnotationPostProcessor` is missing a bean dependency registration causing errors in target applications when Messaging Annotations configuration is used. * Add `registerDependentBean()` into an `AbstractMethodAnnotationPostProcessor` when we generate and register a `ConsumerEndpointFactoryBean` * Change one of the `ClientManagerBackToBackTests` configuration to rely on a `@ServiceActivator` for `Mqttv5PahoMessageHandler` bean to ensure that change in the `AbstractMethodAnnotationPostProcessor` has a proper effect **Cherry-pick to `6.1.x` & `6.0.x`**
Fixes #8654 Spring Framework has an ability to start dependant beans automatically when we start the current one. The `AbstractMethodAnnotationPostProcessor` is missing a bean dependency registration causing errors in target applications when Messaging Annotations configuration is used. * Add `registerDependentBean()` into an `AbstractMethodAnnotationPostProcessor` when we generate and register a `ConsumerEndpointFactoryBean` * Change one of the `ClientManagerBackToBackTests` configuration to rely on a `@ServiceActivator` for `Mqttv5PahoMessageHandler` bean to ensure that change in the `AbstractMethodAnnotationPostProcessor` has a proper effect **Cherry-pick to `6.1.x` & `6.0.x`**
…ng-projects#8657) Fixes spring-projects#8654 Spring Framework has an ability to start dependant beans automatically when we start the current one. The `AbstractMethodAnnotationPostProcessor` is missing a bean dependency registration causing errors in target applications when Messaging Annotations configuration is used. * Add `registerDependentBean()` into an `AbstractMethodAnnotationPostProcessor` when we generate and register a `ConsumerEndpointFactoryBean` * Change one of the `ClientManagerBackToBackTests` configuration to rely on a `@ServiceActivator` for `Mqttv5PahoMessageHandler` bean to ensure that change in the `AbstractMethodAnnotationPostProcessor` has a proper effect **Cherry-pick to `6.1.x` & `6.0.x`**
Expected Behavior
I'm building an application which transfers/transforms messages between TCP and MQTT.
I would like to monitor the connections, to be able to configure some alerts when connections stay down for a certain amount of time/consecutive negative checks.
Current Behavior
I implemented multiple @scheduled methods with a fixed delay of x seconds to check both the status of Tcp and Mqtt connections. For Tcp I'm checking if there are open connections by calling
getOpenConnectionIds()
on eitherAbstractClientConnectionFactory
orAbstractServerConnectionFactory
which works fine and does the job.I'm trying to do something similar for checking the connection (NOT subscription) with the Mqtt-broker but without success. The most obvious way would be to call the
isConnected()
method onIMqttAsyncClient
in eitherMqttv5PahoMessageDrivenChannelAdapter
orMqttv5PahoMessageHandler
, but since this client has private access, I'm not able to check the connection.Context
Is there any way of achieving this with the existing codebase? If not, would it be possible to:
Mqttv5PahoMessageDrivenChannelAdapter
andMqttv5PahoMessageHandler
TcpConnectionOpenEvent
once the Mqtt client is connected successfully to the broker?The text was updated successfully, but these errors were encountered: