Is there anyway to manually start/init a channel adapter?
I have two pairs of inbound/outbound adapters in my context.xml and would like to decide at runtime which one of them I want to get started.
EDIT:
The concrete scenario:
I have a client, that can be configured at runtime to be an mqtt publisher or subscriber.
My context.xml looks like this:
<int-mqtt:message-driven-channel-adapter
client-id="foo"
auto-startup="true"
url="tcp://192.168.97.164:1883"
topics="testtopic/#"
channel="writeToFile" />
<file:outbound-channel-adapter
id="writeToFile"
auto-startup="true"
directory="./test/out"
delete-source-files="false"/>
<int:transformer id="Transformer"
ref="MessageTransformer"
input-channel="readFromFile"
output-channel="mqttOut"
method="bytesFromFile" />
<bean id="MessageTransformer" class="MessageTransformer"/>
<int-mqtt:outbound-channel-adapter
id="mqttOut"
client-id="foo"
url="tcp://192.168.97.164:1883"
auto-startup="false"
default-qos="1"
default-retained="true"
default-topic="testtopic/bla"
/>
<file:inbound-channel-adapter
auto-startup="false"
id="readFromFile"
directory="./test/in"
filename-pattern="myFile*">
<int:poller id="poller"
fixed-rate="5000" />
</file:inbound-channel-adapter>
As you can see, I have two settings:
1. Subscriber case: Read mqtt message -> Write to file
2. Publisher case: Poll a file from directory -> Send via mqtt
I decide at runtime what setting is to be applied.
So can you kindly tell me how this control-bus thing would fit here exactly?
See Question&Answers more detail:os