Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Gowtham Babu Tummala
    @gowthamt4
    spring:
      rabbitmq:
        host: 127.0.0.1
        port: 5672
        username: guest
        password: guest
    The second microservice is not able make connection with rabbit mq and throwing Connection Refused exception
    Am I missing anything over here ? I already wasted two days on this :(
    1 reply
    kalnida1
    @kalnida1
    probably your rabbitmq container is running on different ip, provided by docker
    choubani amir
    @amirensit
    hello. Getting confused about Jackson2JsonMessageConverter vs MappingJackson2MessageConverter
    Any idea ?
    choubani amir
    @amirensit
    I think I get response here
    So Jackson2JsonMessageConverter is used as "message converter" (which is the first step of conversion) and MappingJackson2MessageConverter is used as "method argument converte" (which is the second step of conversion)
    Am I wrong ?
    Gary Russell
    @garyrussell
    Yes, the mapping converter is a generic converter provided by spring-messaging; in general it is not needed/used for a @RabbitListener since we now "tell" the Jackson2JsonMessageConverter about the parameter type in the method.
    choubani amir
    @amirensit
    :thumbsup:
    John Hendrikx
    @hjohn
    I'm looking for a way to set up a scoped bean which is active for the duration of a call annotation with RabbitListener. Defining an Around aspect around the annotation runs too late (MessagePostProcessor are called already before the advice runs). Setting the advice chain also runs after the MessagePostProcessor. Overriding the TaskExecutor seems early enough, but it looks like it doesn't create a new task for each message received. I could do some of the work in a MessagePostProcessor, but I'd need a way to know when the RabbitListener annotated method finishes (so I can kill the scope). I suppose I could do the setup in a post processor, and the clean up in an Aspect. Are the any other possibilities?
    6 replies
    Priyanshu Shukla
    @priyanshus1
    Hi Communty,
    I am looking for a solution where we can mock amqp responses, some sort of mockserver for AMQP
    Gary Russell
    @garyrussell
    There is the beginnings of a basic framework in spring-rabbit-test https://docs.spring.io/spring-amqp/reference/html/#test-template but it's not very sophisticated. Some people have had some success using Apache QPID embedded broker (as long as RabbitMQ extensions are not being used). Most people, however, use a real broker for testing. TestContainers is another option: https://www.testcontainers.org/modules/rabbitmq/
    1 reply
    Priyanshu Shukla
    @priyanshus1

    Hi Community,
    I have a general question on a use case, people use our API through HTTPs we have a service exposing these APIs and a service which has business logic.
    Now we have put a RM queue between API service and business logic, but still need our APIs to be synchronous and we are using reply queues for that.

    is this architecture good ? Does this have any draw backs ?

    Riain Condon
    @Stetchy

    Hi,

    I'm trying to connect my service to RabbitMQ over TLS. The RabbitMQ host I'm using is an AWS ELB pointing to the RabbitMQ cluster which uses an amazon-managed TLS certificate.

    Is it possible to do this? When I try to, I get the following:

    javax.net.ssl.SSLHandshakeException: No trusted certificate found as it's trying to find the certificate locally even though it's signed and validated as it's managed by amazon?

    7 replies
    Riain Condon
    @Stetchy
    Hi again - does the trustStore have to be in a certain directory?
    I'm setting it with spring.rabbitmq.ssl.trust-store but it cant find it if I even put it in the same directory as config and if I put it in say /usr/share/application/trustStore and specify as that, it seems to cut off the first /
    Screenshot 2021-01-07 at 13.38.35.png
    6 replies
    Thilo-Alexander Ginkel
    @ginkel
    Hi! Is there a way to customize the CachingConnectionFactory using some kind of customizer (when using Spring Boot) without constructing it manually? I'd like to configure an Executor (so more than 2x vCPU threads can be used)
    Thilo-Alexander Ginkel
    @ginkel
    So, effectively I am looking for a way to call org.springframework.amqp.rabbit.connection.AbstractConnectionFactory#setExecutor on the default ConnectionFactory created by the org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
    Thilo-Alexander Ginkel
    @ginkel
    Found a way using a SmartInitializingSingleton
    18 replies
    Alexey Anufriev
    @alexey-anufriev

    I have an excepion being thrown from the post-processor, and I would like to have error handler for this case. I can use org.springframework.util.ErrorHandlerfor container, but in fact I would also like to have access to the message itself.

    RabbitListenerErrorHandler will not help in this case as exception happens earlier, before the listener.

    In the ConditionalRejectingErrorHandler I saw this check t instanceof ListenerExecutionFailedException but in my case it is original exception.

    What are the other options?

    2 replies
    Gowtham Babu Tummala
    @gowthamt4
    Hi! Is there any way to autowire the beans in the Listener extending from MessageListener ? I need to perform some business logic inside onMessage(Message message). But I am unable to access Autowire beans inside onMessage method
    20 replies
    maglioneangelo
    @maglioneangelo

    Hello,
    Is there any way to try to create a channel with another Node of a RMQ Cluster in case of some Exception like this one?

    '''
    Caused by: com.rabbitmq.client.ChannelContinuationTimeoutException: Continuation call for method #method<channel.open>(out-of-band=) on channel AMQChannel(amq
    p://sqfo-apps-fix-engine-six@{HOST1}/tradingsystems,655) (#655) timed out
    at com.rabbitmq.client.impl.AMQChannel.wrapTimeoutException(AMQChannel.java:313)
    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:295)
    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:141)
    at com.rabbitmq.client.impl.ChannelN.open(ChannelN.java:128)
    at com.rabbitmq.client.impl.ChannelManager.createChannel(ChannelManager.java:182)
    at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:618)
    at org.springframework.amqp.rabbit.connection.SimpleConnection.createChannel(SimpleConnection.java:58)
    ... 32 more
    Caused by: java.util.concurrent.TimeoutException
    at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
    at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:120)
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:502)
    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:293)
    '''

    It seems that the application try to create a channel always with the same node, instead to switch on some other node.

    forgetaboutme
    @forgetaboutme
    Hi, if I use RabbitAutoConfiguration with a POJO listener (that has a @RabbitListener annotation on function receiveMessage, with an id), how can I access the container that is running the message listener? I would like to intercept an application event (spring boot) in order to stop my container but it seems I cannot get a hold of this container. I tried using the RabbitListenerEndpointRegistry but no success.. even if I define it as a bean, there are no containers attached to it. It seems like the @RabbitListener is not being registered in the RabbitListenerEndpointRegistry that I manually create (bean).
    forgetaboutme
    @forgetaboutme
    I am also using the RabbitAutoConfiguration bean
    3 replies
    Patrik Mihalcin
    @pmihalcin
    Hi all.. is there some easy way how to implement browse feature in AMQP similar to jmsTemplate.browse(...)?
    My goal is to look at messages in given queue and I want to assert those messages if they match some criteria
    84 replies
    Jan Mareš
    @maresja1
    Hello, since upgrading to spring boot 2.4.0 (now on spring boot 2.4.1 amqp 2.3.4, this issue persists), I started having issues with messages not processed. At some random point, it seems the BlockingQueueConsumer only stores the message (manifested by Storing delivery for consumerTag in the logs), but no one picks up the messages from the queue (absence of Received message: in the logs). This leads to lots of unacked messages in RabbitMQ, after which RabbitMQ stops sending messages completely. It happens after hours or days of uptime, randomly. The logs at the time, when this happens do not show anything helpful (regarding some exceptional state). RabbitMQ connection is healthy, therefore the service needs force restart. Everything was work fine on Spring Boot 2.3.x. Any help would be hugely appreciated.
    3 replies
    Priyanshu Shukla
    @priyanshus1
    Hi Community,
    We are using RabbitTemplate.convertSendAndReceiveAsType (Request Response Pattern). We are sometimes noticing in our logs that basicPublish event does not start for around 1 min and thread just sleep for that time.
    We did the investigation but cannot find out a reason so after calling the function it should publish immediately right ? or am I missing something.
    This happens atleast 4-5 times a per day for unique requests.
    Any suggestion for our investigation will be helpful.
    Thanks
    5 replies
    Priyanshu Shukla
    @priyanshus1
    Hi Community,
    In case of RPC mechanism when connection times out does direct-reply to threads(channel) which are waiting for a response also times out ?
    1 reply
    Florian Ruschbaschan
    @floruschbaschan
    Hey all, since we upgraded to SpringBoot 2.3.x and JUnit5, we evaluated @RabbitAvailable for our integration test purposes (RabbitMQ is running as an own docker container). Here we noticed that according to the class comment the check is only implemented for local running brokers ("Test classes annotated with this will not run if there is no broker on localhost.")
    Additionally we saw that BrokerRunningSupport supports overrides by the System Environment. We would rather like to pass our RabbitMQ credentials as runtime arguments. Is there a specific reason why the SystemProperties are not used instead? Any support on this would be much appreciated.
    2 replies
    Aleh
    @AlehGalo
    Hello to everyone. Could you please help me with Spring-ampq + RabbitMQ + spring-boot
    I’m creting Queues/Exchanges/Bindings with the help of spring.
    Queues and exchanges are created successfully but bindings are absent. As a result no messages are transfered to the queue.
    Aleh
    @AlehGalo
    Screenshot 2021-03-03 at 11.25.56.png
    Aleh
    @AlehGalo
    Sorry, my bad

    I was doing

    @Bean
    public Binding bbbBinding() {
    return BindingBuilder.bind(bbbQueue())
    .to(requestExchange())
    .with("*");
    }

    but AMPQ 2.2.6 is changed
    @Bean
    public Binding bbbBinding() {
    return BindingBuilder.bind(bbbQueue())
    .to(requestExchange())
    .with("*”).noargs();
    }
    additional .noargs()
    Gary Russell
    @garyrussell
    Please learn how to use markdown - click the M icon on the right. Add three back ticks on a separate line before and after code snippets.
    It is not clear why you would see such behavior. DEBUG logging will show declaration activity.
    willladislaw
    @willladislaw
    This message was deleted
    1 reply
    Amruta Wandakar
    @amrutawandakar
    Hi all, Hopefully i'm asking my query in right forum. I'm trying to use HttpSession in @RabbitListener(it's receiver project) i'm gteting some eeror while setting up session. error message is
    No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
    can anyone help me out please
    1 reply
    Mohit Darmwal
    @mickmohit
    Hello Team , i facing issues with RabbitListenerTestHarness, it is not working
    Hello Team , i facing issues with RabbitListenerTestHarness, it is not working. Below is my project structure

    Main class

    @Component
    public class ABC {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @RabbitListener(id="id", queues="${queue}")
    public void receiveMessage(String message) {
    publishMsg(message);
    }

    public void publishMsg(String msg){
    amqpTemplate.convertAndSend("exchange", "",msg);
    }

    }
    test class

    @RunWith(SpringRunner.class)
    @SpringBootTest
    public class ABCTest {

    @Autowired
    private RabbitListenerTestHarness harness;

    @Autowired
    private RabbitTemplate rabbitTemplate;
    @Test
    public void testSendtoQueue() throws Exception {
    ABC listener = this.harness.getSpy("id");
    assertNotNull(listener);

    LatchCountDownAndCallRealMethodAnswer answer = this.harness.getLatchAnswerFor("id", 1);
    doAnswer(answer).when(listener).receiveMessage(any(String.class));

    String data = getMockString("src/test/resources/rabbitMQ-data.json");

    this.rabbitTemplate.convertAndSend("Queue-name", data);

    //assertTrue(answer.await(10));
    verify(listener,times(1)).receiveMessage("data");
    }
    }

    and on running above it gives me error as below

    Wanted but not invoked:
    customPublisherSubscriber.receiveMessageFromResponseQ(
    "data"
    );
    -> at aero.sita.sp.spm.service.ABC.testSendtoQueue(CustomPublisherSubscriberTest.java:67)
    Actually, there were zero interactions with this mock.

    at aero.sita.sp.spm.service.ABC.testSendtoQueue(CustomPublisherSubscriberTest.java:67)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    i was referring to https://github.com/spring-projects/spring-amqp/blob/master/src/reference/asciidoc/testing.adoc.

    I am struggling to understand as i am trying to verify spy object for message received or not, but it is reporting issues related to mock object. Could you please assist me on this.
    Gary Russell
    @garyrussell

    Please learn how to use Gitter markdown (click the M on the right). You need to surround your code with three back-ticks (fences) on separate lines before and after the code).

    What is

    customPublisherSubscriber.receiveMessageFromResponseQ(

    ? I don't see that either in your code or the test.

    Gary Russell
    @garyrussell
    Stack overflow is generally a better venue for questions like this because it's easier to show code, configuration, and logs.
    Mohit Darmwal
    @mickmohit
    @garyrussell i have asked the same over stackoverflow https://stackoverflow.com/questions/66986114/issues-with-rabbitlistenertestharness-it-is-not-working , could you please help me on this
    Priyanshu Shukla
    @priyanshus1
    Hi Community,
    Do we know if Direct-Reply To for RPC is better performant than Fixed Reply Queues ?
    1 reply
    Priyanshu Shukla
    @priyanshus1
    @garyrussell I have set useDirectReplyToContainer to false and set a reply address on rabbitTemplate with a fixed queue created before hand. I wish to control the concurrency for consumers. Do you think this idea works or still consumers will be created per request.
    3 replies