Announcement Announcement Module
Collapse
No announcement yet.
rabbitmq channel logging Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • rabbitmq channel logging

    I have a rabbitmq channel declared in a java config as follows:

    Code:
        @Bean
        public ConnectionFactory connectionFactory() {
            return new CachingConnectionFactory(RABBIT_HOST);
        }
    
        @Bean(name = "rabbitChannel")
        public Channel rabbitChannel() throws IOException {
            Connection connection = connectionFactory().createConnection();
            Channel channel = connection.createChannel(false);
            channel.exchangeDeclare(EXCHANGE, EXCHANGE_TYPE);
            return channel;
        }
    I would like to wire-tap a logger to this channel. Is it possible to create an xml wiretap and reference the rabbitChannel bean in it?

  • #2
    Hi!
    Is it possible to create an xml wiretap and reference the rabbitChannel bean in it?
    Yes, you can: http://static.springsource.org/sprin...-configuration Global Wire Tap Configuration.
    However you misunderstand a bit an environment.
    Wire Tap is a component of Spring Integration and it is for MessageChannels from Spring Integration.
    But here you create a bean of com.rabbitmq.client.Channel.

    Can you explian what do you want to get? Your use-case

    Cheers,
    Artem

    Comment


    • #3
      Yes this was my dilemma. I would like to log a rabbitmq channel. Is it possible to do so with a Spring Integration logger?

      Comment


      • #4
        H-m-m...
        Do you want to log something like basicPublish? So, you're going to send Messages manually?
        Some crazy advice: http://static.springsource.org/sprin...ed-interceptor

        Comment


        • #5
          Yes.

          I think I'll just have a logger print a message within the basicPublic method for now.

          Thanks!

          Comment


          • #6
            Better solution:

            - use Spring Integration message channel + a spring-to-rabbit outbound channel adapter

            Comment

            Working...
            X