Class MessageChannelItemWriter<T>
java.lang.Object
org.springframework.batch.integration.support.MessageChannelItemWriter<T>
- Type Parameters:
T- the type of items to be written
- All Implemented Interfaces:
org.springframework.batch.infrastructure.item.ItemWriter<T>
public class MessageChannelItemWriter<T>
extends Object
implements org.springframework.batch.infrastructure.item.ItemWriter<T>
An
ItemWriter implementation that sends items as messages to a message channel
using a MessagingTemplate. This item writer enables SEDA (Staged Event-Driven
Architecture) patterns in Spring Batch jobs by decoupling item production from item
consumption through messaging.- Since:
- 6.0.0
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionMessageChannelItemWriter(org.springframework.integration.core.MessagingTemplate messagingGateway) Create a newMessageChannelItemWriterinstance.MessageChannelItemWriter(org.springframework.integration.core.MessagingTemplate messagingTemplate, org.springframework.messaging.MessageChannel messageChannel) Create a newMessageChannelItemWriterinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetMessageChannel(org.springframework.messaging.MessageChannel messageChannel) Set the target message channel.void
-
Constructor Details
-
MessageChannelItemWriter
public MessageChannelItemWriter(org.springframework.integration.core.MessagingTemplate messagingGateway) Create a newMessageChannelItemWriterinstance. Messages will be sent to the default destination of the providedMessagingTemplatewhich must not be null.- Parameters:
messagingGateway- the messaging template to use for sending messages
-
MessageChannelItemWriter
public MessageChannelItemWriter(org.springframework.integration.core.MessagingTemplate messagingTemplate, org.springframework.messaging.MessageChannel messageChannel) Create a newMessageChannelItemWriterinstance. Messages will be sent to the provided message channel.- Parameters:
messagingTemplate- the messaging template to use for sending messagesmessageChannel- the message channel to send messages to
-
-
Method Details
-
setMessageChannel
public void setMessageChannel(org.springframework.messaging.MessageChannel messageChannel) Set the target message channel.- Parameters:
messageChannel- the message channel to send messages to
-
write
-