Reputation: 6717
The Spring Integration reference guide refers to using a MessageStore implementation to provide persistence to a QueueChannel.
It's mentioned many times but all examples are using XML config, i.e
<int:channel id="dbBackedChannel">
<int:queue message-store="channelStore"/>
</int:channel>
<bean id="channelStore" class="o.s.i.jdbc.store.JdbcChannelMessageStore">
<property name="dataSource" ref="dataSource"/>
<property name="channelMessageStoreQueryProvider" ref="queryProvider"/>
</bean>
But the implementation of QueueChannel has no methods for setting the MessageStore
So how could I create a QueueChannel with a MessageStore without using XML configuration?
Upvotes: 1
Views: 1082
Reputation: 6717
Reverse engineered what the XML config did, and this is the answer.
You have a wrap the MessageStore in a MessageGroupQueue
So it would look something like this
@Bean
public MessageChannel messageStoreBackedChannel() {
return new QueueChannel(
new MessageGroupQueue(<<MessageStoreImplementation>>, "Group ID")
);
}
Upvotes: 4