Announcement Announcement Module
Collapse
No announcement yet.
Best way to get the status of Consumer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best way to get the status of Consumer

    Thought this could be a new thread. Is there any way in Spring Integration from which I could get the status (running/stopped) of any of my consumer ??

  • #2
    Use a <gateway/> to send a message to the control bus...

    Code:
    public interface ControlBus {
        boolean command(String command);
    }
    
    <int:gateway service-interface="foo.ControlBus" default-request-channel="controlBusChannel"/>
    
    ...
    
    @Autowired
    private ControlBus controlBus;
    
    ...
    
    if (controlBus.command("@rabbitAdapter.isRunning()")) {
       ...
    }

    Comment


    • #3
      Thank you Gary. One very dumb question, are you declaring the controlBus variable and the "if" statement in the main here ?

      Comment


      • #4
        In this case I @Autowired it (assumes the current class was a class declared in the Spring config).

        If you are running from a main, and creating an application context, you can get a reference to it using

        Code:
        ControlBus controlBus = context.getBean(ControlBus.class)
        This assumes there is only one instance of ControlBus in the context (which there usually would be).

        Comment

        Working...
        X