View Full Version : Starting a ChannelAdapter when auto-start = false
Oct 16th, 2009, 01:50 PM
I have set the auto-startup attribute on my ChannelAdapter to false and would like to programmatically start it. How do I accomplish this?
Oct 16th, 2009, 01:56 PM
You can do a bean lookup (or inject it by reference).
One question: does the channel-adapter have both "id" and "channel" attributes?
Oct 16th, 2009, 02:00 PM
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.
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(serviceResources);
DirectChannel endpoint = (DirectChannel)ctx.getBean("xmlFile");
There is no way to start it, correct?
<integration:interval-trigger time-unit="SECONDS" interval="1"/>
Oct 16th, 2009, 02:50 PM
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.
Oct 16th, 2009, 02:57 PM
It makes sense now. Thanks for the explanation.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.