Persisting and recovering channels

We talked about all kind of channels, but if you have noticed, these are all in memory. What if the system crashes? No one wants to lose data. This is where persistent QueueChannel comes into the picture—messages will be backed up in the database defined by the data source. If the system crashes, then on recovery, it will pull all the messages in the database and queue them for processing. This is achieved in Spring using MessageGroupStore. Let's have a quick look at the configuration:

<int:channel id="resultPersistenceChannel">
  <int:queue message-store="messageStore"/>
</int:channel>

<int-jdbc:message-store id="messageStore" data-source="someDataSource"/>

Here, the message store is mapped to the database defined ...

Get Spring Integration Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.