Announcement Announcement Module
Collapse
No announcement yet.
Starting a ChannelAdapter when auto-start = false Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Starting a ChannelAdapter when auto-start = false

    I have set the auto-startup attribute on my ChannelAdapter to false and would like to programmatically start it. How do I accomplish this?

    Thanks.

  • #2
    You can do a bean lookup (or inject it by reference).

    One question: does the channel-adapter have both "id" and "channel" attributes?

    Comment


    • #3
      Just the id. I'm sorry - I'm missing something in your response. If I lookup the bean via the context, I get the bean - in this case the DirectChannel.

      <pre>
      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(serviceResources);
      DirectChannel endpoint = (DirectChannel)ctx.getBean("xmlFile");
      </pre>

      There is no way to start it, correct?

      <pre>
      <file:inbound-channel-adapter id="xmlFile"
      directory="file:/virat/inputxml"
      auto-create-directory="false"
      auto-startup="false"
      filename-pattern=".+.xml">
      <integrationoller>
      <integration:interval-trigger time-unit="SECONDS" interval="1"/>
      </integrationoller>
      </file:inbound-channel-adapter>
      </pre>

      Comment


      • #4
        Yes, that's why I asked about the "id" and "channel". If you don't provide a value for "channel", then the value in "id" is used as the name of an auto-created channel. So, you have two options:

        1) create a channel and reference it from the "channel" attribute so that the "id" value is used for the adapter bean instead of the auto-created channel bean

        2) lookup the bean named "x.adapter" where "x" is the value of your "id" attribute (and hence the channel name)

        This was originally designed to be a *convenience* but after explaining it a few times, I realize it can be a bit confusing.

        Hope that helps.
        Mark

        Comment


        • #5
          Mark,
          It makes sense now. Thanks for the explanation.
          Mike

          Comment

          Working...
          X