You probably may consider to use a JdbcChannelMessageStore and a QueueChannel based in it. So, one service would send a message to this channel within its transaction. On the other side there is going to be a polling consumer to read from that channel, and therefore your messages table. NOTE: this solution removes messages from the INT_CHANNEL_MESSAGE table in the end of poll transaction.
You may consider to use a JPA Outbound Channel Adapter to persist message on one side and JPA Polling Channel Adpater on the other side to update the entity.
发布评论
评论(1)
这正是春季整合的目的。
您可能会考虑使用基于其中的
JDBCCHANNELMESSAGESTORE
和Queuechannel
。因此,一项服务将在其交易中将消息发送到此渠道。另一方面,将会有一个投票消费者可以从该渠道阅读,因此您的消息表。注意:此解决方案在轮询事务结束时从int_channel_message
表中删除消息。您可能会考虑使用JPA出站通道适配器在一侧持续存在消息,而另一侧的JPA轮询通道adpater来更新实体。
请参阅文档中的更多信息: https:// docs:// 。
That's exactly what Spring Integration is for.
You probably may consider to use a
JdbcChannelMessageStore
and aQueueChannel
based in it. So, one service would send a message to this channel within its transaction. On the other side there is going to be a polling consumer to read from that channel, and therefore your messages table. NOTE: this solution removes messages from theINT_CHANNEL_MESSAGE
table in the end of poll transaction.You may consider to use a JPA Outbound Channel Adapter to persist message on one side and JPA Polling Channel Adpater on the other side to update the entity.
See more in docs: https://docs.spring.io/spring-integration/docs/current/reference/html/jpa.html#jpa
Either way I don't see problems in implementing that pattern with Spring Integration.