简体   繁体   English

Rabbit 侦听器方法没有被传入消息调用

[英]Rabbit listener method is not getting invoked with the incoming message

I have a method to consume messages in similar line as shown below:我有一种方法可以在类似的行中使用消息,如下所示:

@RabbitListener(queues = "${com.rabbimq.myQueue}")
public void receive(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag)
        throws IOException {
    log.info("Received msg: {}",msg);
    channel.basicAck(tag, false);   
}

This works fine when I execute it as a SpringBoot project.当我将它作为 SpringBoot 项目执行时,这可以正常工作。 But when I build this project and put it as a dependency in my other project, it no longer consumes the message.但是当我构建这个项目并将其作为依赖项放在我的另一个项目中时,它不再使用该消息。 I want this to be a generic project which can be leveraged by my other projects.我希望这是一个可以被我的其他项目利用的通用项目。 I have put some loggers in this "message consumption" project and I can see that all the beans are getting created.我在这个“消息消费”项目中放了一些记录器,我可以看到所有的 bean 都被创建了。 But it's not invoking this particular method.但它没有调用这个特定的方法。 Any pointers here is really appreciated.这里的任何指针都非常感谢。

The class that this method is in must be declared as a @Bean or, if it is a @Component, it must be in a package that is scanned for component scanning.此方法所在的 class 必须声明为 @Bean,或者,如果它是 @Component,则必须在为组件扫描而扫描的 package 中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用传入消息端点处理程序详细信息调用 Kafka Listener 方法 - Kafka Listener method could not be invoked with the incoming message Endpoint handler details Spring AMQP 错误:无法使用传入消息调用侦听器方法 - Spring AMQP Error: Listener method could not be invoked with the incoming message org.springframework.kafka.listener.ListenerExecutionFailedException:侦听器方法无法与传入消息一起调用 - org.springframework.kafka.listener.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message 没有调用BackBean中的Submit Listener方法 - Submit Listener Method in the BackBean is not getting invoked Rabbit消息侦听器的执行失败,并且未设置ErrorHandler。 无法使用参数类型= [class [B],调用目标方法, - Execution of Rabbit message listener failed, and no ErrorHandler has been set. Failed to invoke target method with argument type = [class [B], 如何在 Spring 集成中对 Rabbit MQ 消息侦听器强制执行严格排序? - How to enforce strict ordering for a Rabbit MQ message listener in Spring Integration? Spring Rabbit Listener关闭处理程序或返回没有重新传递标志的消息 - Spring Rabbit Listener shutdown handler or return message without redelivered flag Spring - 在 RabbitMQ 侦听器中验证传入消息 - Spring - Validate incoming message in RabbitMQ listener jTextArea不显示方法中的传入消息 - jTextArea not showing incoming message in method MethodInvokingFactoryBean-方法未被调用 - MethodInvokingFactoryBean- method not getting invoked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM