-
Notifications
You must be signed in to change notification settings - Fork 31
Creating Publisher part1
Now that you have done implementing Subscriber, we start with Publisher . As the name suggests this container will be used to publish events that can be processed by an EventProcessor or consumed by Subscriber.
Same rule applies for publisherwiring.xml regarding its name. Follow these steps for publisherwiring.xml:
- You will see below Spring XML configuration fragment first.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
default-lazy-init="false">
</bean>This is a boilerplate that allows you to take advantage of the new Spring 4.0 XML tags since they make configuration easier.
- Configuration for outbound Message inside #1:
<bean id="OutboundMessageChanneBinder" class="com.ebay.jetstream.event.support.channel.ChannelBinding"
depends-on="MessageService">
<property name="channel" ref="OutboundMessages" />
</bean>
<bean id="OutboundMessages"
class="com.ebay.jetstream.event.channel.messaging.OutboundMessagingChannel"
depends-on="MessageService">
<property name="address" ref="OutboundMessageChannelAddress" />
</bean>
<bean id="OutboundMessageChannelAddress"
class="com.ebay.jetstream.event.channel.messaging.MessagingChannelAddress">
<property name="channelTopics">
<list>
<value>Jetstream.demo/Person</value>
</list>
</property>
</bean>The bean definition shown above is an example of defining an outbound message channel in Spring syntax. This channel will publish an event on all provisioned topics unless the event contains hints to publish on one or more specific topics. If the topics specified through the hints match one of the provisioned topics then the event will be published on that topic.
- Event generator
<bean id="EventGenerator" class="com.ebay.jetstream.event.generator.GenericEventGenerator"
depends-on="OutboundMessages">
<property name="rate" value="1000" />
<property name="eventCount" value="5000000000" />
<property name="genAfinityKey" value="true" />
<property name="sendEventsOnInit" value="true" />
<property name="eventSinks">
<list>
<ref bean="SampleProcessor" />
</list>
</property>
</bean>
<bean id="SampleProcessor" class="com.ebay.jetstream.demo.publisher.processor.SampleProcessor">
<property name="eventSinks">
<list>
<ref bean="OutboundMessages" />
</list>
</property>
</bean>The Event generator will generate the simulated events.
[Next: Creating-Publisher-part2] (../wiki/Creating-Publisher-part2)