Selecting a channel
Let's discuss what default implementations have been provided by Spring Integration and how they can be leveraged.
Publish-subscribe channel
This is the only implementation of the publish-subscribe model of channel. The primary purpose of this channel is to send messages to registered endpoints; this cannot be polled. It can be declared as follows:
<int:publish-subscribe-channel id="pubSubChannel"/>
Let's discuss each of the elements in this line; this will be used throughout the examples of this chapter:
int
: This is a namespace that declares all Spring Integration components. As discussed in Chapter 1, Getting Started, the STS visual editor can be used to add different namespaces from Spring Integration.publish-subscribe-channel
: This is the type exposed by Spring.Id
: This is the unique name through which the channel can be referred.
To refer to these elements from the code, we can use:
public class PubSubExample { private ApplicationContext ctx...