Announcement Announcement Module
Collapse
No announcement yet.
How to inject message bus into service class? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to inject message bus into service class?

    Hi, I am new to S.I and i have a question about message bus.

    I'm considering using S.I in my application. I found that S.I is a kind of 'entrance' to application, the message bus needs to be started at the beginning.

    I wonder is there any way to inject the message bus into a certain service class and kick start the bus in that service?

  • #2
    Hi,

    You can have your service implement the MessageBusAware interface.

    That will auto-inject the MessageBus into your class (if using the namespace <message-bus/> definition.

    Otherwise, the message bus will start by default after being initialized so there's no need to start it manually (the latest samples show that).

    Marius

    Comment


    • #3
      Marius,
      Where're latest samples show that?

      Comment


      • #4
        Hi,

        Where're latest samples show that?
        You can check out the org.springframework.integration.samples" project from TRUNK for more detail. Essentially, there's no need for calling messageBus.start() or context.start(), for that matter.

        Regards,
        Marius

        Comment

        Working...
        X