Skip to content

Outbound Message Channel

rmuthupandian edited this page Feb 11, 2015 · 1 revision

The Outbound Message Channel is a specialized Jetstream Outbound Channel implementation built on top of Jetstream Cluster messaging. It enables event streams to be published on Jetstream Pub-Sub messaging Topics intended to be processed in Jetstream Applications. The Outbound Message Channel layers on top of the Jetstream Messaging Service. It receives events from upstream sources and then publishes those events over provisioned topics.

There is no software development required to use this channel. All that is needed is to provide the bean specification for the channel and its supporting beans to the Jetstream Container.

This section shows you how to provision an Outbound Message Channel in Spring XML. There are 3 beans that need to be provisioned for an Outbound Message Channel to operate correctly viz. ChannelBinding, OutboundChannel and ChannelAddress.

Specify Channel Binder for OutboundMessageChannel

A channel binder is a container of the channel and performs lifecycle management and flow control for channels

<bean id="OutboundMessageBinder" scope="singleton"
		class="com.ebay.jetstream.event.support.channel.ChannelBinding"
		depends-on="MessageService">
	<property name="channel" ref="OutboundMessages" />
</bean>

Specify the OutboundMessageChannel bean.

<bean id="OutboundMessages"
		class="com.ebay.jetstream.event.channel.messaging.OutboundMessagingChannel">
	<property name="address" ref="OutboundChannelAddress" />
	<property name="alertListener" ref="<somealertlistener>" />
        <property name="eventSinks">
	     <list>
		  <ref bean="<somesink>" />
	      </list>
        </property>

</bean>

This bean takes a reference to an address bean containing all the topics for subscription, if an alert listener bean is optionally injected it can generate alerts and send it to the alert listener.

Specify the address bean

This is how you specify a list of Jetstream Messaging topics that this channel publishes on.

<bean id="OutboundChannelAddress"
	class="com.ebay.jetstream.event.channel.messaging.MessagingChannelAddress">
	<property name="channelTopics">
		<list>
			<value>Jetstream.demo/rawEvent</value>
	           </list>
	</property>
</bean>

The Outbound Channel layers on top of the Jetstream Message Service. This service needs to be provisioned.The topics provisioned for the Outbound Message Channel as Channel addresses have a root context. E.g for the topic "Jetstream.demo/rawEvent", "Jetstream.demo" is the root context. This root context must be bound to a Netty transport instance in MessageServiceProperties bean.

Configuring an Advice Listener

The Outbound Channel can provide advise to a listener when a event can not be forwarded to a down stream consumer cluster because the cluster either has no consumers or there is slowness in one of the consumer nodes. The listener can forward the event to a KafkaOutboundChannel. A replayer application can be deployed to listen to kafka and forward the event to the downstream consumer application cluster as shown in figure below. The advice listener can control the replayer via a notification topic bound to the root context Rtbdpod.local. It will use that topic to send pause and resume signals to the replayer inbound kafka channel.

#Screenshot

This way one can use a push model but still have very high transport reliability guarantees.

The following XML bean definitions shows how to wire an application to trap advisories and route events to kafka for replay.

<bean id="OutboundMessages"
		class="com.ebay.jetstream.event.channel.messaging.OutboundMessagingChannel">
	<property name="alertListener" ref="<adviceprocessor>" />
</bean>

<bean id="adviceprocessor" class="com.ebay.jetstream.event.support.AdviceProcessor">
		<property name="retryEventCodes">
			<list>
				<value>MSG_RETRY</value> 
				<value>QUEUE_FULL</value>
				<value>PAUSE_RETRY</value>
			</list>
		</property> 
		<property name="eventSinks">
			<list>
				<ref bean="outboundKafkaChannel" />
			</list>
		</property>
		<property name="replayNotificationTopic" value="Rtbdpod.local/replay-Notification-<topicname>" />
</bean>
Clone this wiki locally