Announcement Announcement Module
No announcement yet.
Status of the adapters Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Status of the adapters

    Hi Guys ,

    these days i am working on a application which consist multiple types of input and out put adapters. So we need some kind of control screen which we can use to start and stop adapters when ever we need. we have JEE web application and we thought is is really nice if we can enable and disable buttons according the current status of each component.

    For an Example suppose we have jms inbound adapter. In the control screen we have 2 buttons for start and stop. when we start the adapter the start button should go disable until we press the stop button like wise...

    Do you guys have any idea about this? Does control bus provides such functionality?

    appreciate your help


  • #2
    Yes, the control bus is good choice for this.

    All the Lifecycle methods are available isRunning(), start(), stop().

    Probably the easiest mechanism is to create a Messaging gateway with a couple of methods...

    public interface ControlBus {
        void sendToVoidMethod(String command); // e.g. @adapter.stop()
        boolean sendToBooleanMethod(String command);  // e.g. @adapter.isRunning()
    And then wire up a <gateway/> to talk to the <control-bus/>.

    Then inject the gateway into your web controller...

    @Autowire private ControlBus gateway;


    • #3
      Hi Gray,

      great, thanx..its working fine. now i want to do a another improvement. Since i have multiple inbound and out bound adapters i want to pick them dynamically and create a control panel, without hard coding. is there any way that we can browse the spring integration bean configurations and pick all the adapters? if we can find out adapters we can use control bus to find rest of the things like status etc...



      • #4
        private ApplicationContext ctx;
        		Map<String, AbstractEndpoint> endpoints = ctx.getBeansOfType(AbstractEndpoint.class);
        		for (Entry<String, AbstractEndpoint> entry : endpoints.entrySet()) {
        			System.out.println(entry.getKey() + ":" + entry.getValue().getClass());
        The map returned has the bean name as a key and the adapter as the value. Of course, now you have a reference to the endpoint itself, you don't need to use the control bus, you can call the lifecycle methods directly.