-
Notifications
You must be signed in to change notification settings - Fork 31
Creating subscriber application Part 2
Now use the messagecontext.xml file inside JetstremConf folder. Note: You can rename it as you like. We will refer it as messagecontext.xml
-
Inside the Spring4.0 boilerplate you will see these beans already present:
- SystemPropertiesConfiguration
- MessageServiceProperties: Defines the configuration for Message Transport services: 0. ZooKeeperTransport 0. NettyTransport
- MessageService
- consistenthashingaffinityscheduler
-
Inside bean "MessageServiceProperties", we add Transport services the Subscriber listens to. First read Transport Services to understand the framework.
-
The transport instance named “netty” is bounded to only 1 root context “Jetstream.demo” and will listen to messages on port 15590. The other properties shall be touched upon
<bean id="MessageServiceProperties"
class="com.ebay.jetstream.messaging.config.MessageServiceProperties">
<property name="nicUsage" ref="NICUsage" />
<property name="transports">
<list>
<ref bean="zookeeper" />
<bean
class="com.ebay.jetstream.messaging.transport.netty.config.NettyTransportConfig">
<property name="transportClass"
value="com.ebay.jetstream.messaging.transport.netty.NettyTransport" />
<property name="transportName" value="netty" />
<property name="protocol" value="tcp" />
<property name="contextList">
<list>
<bean
class="com.ebay.jetstream.messaging.transport.netty.config.NettyContextConfig">
<property name="contextname" value="Jetstream.demo" />
<property name="port" value="15590" />
<property name="scheduler" ref="consistenthashingaffinityscheduler"/>
</bean>
</list>
</property>
<property name="sendbuffersize" value="1048576" />
<property name="receivebuffersize" value="1048576" />
<property name="downstreamDispatchQueueSize" value="262144" />
<property name="connectionTimeoutInSecs" value="10" />
<property name="asyncConnect" value="true" />
<property name="numAcceptorIoProcessors" value="1" />
<property name="numConnectorIoProcessors" value="1" />
<property name="requireDNS" value="false" />
<property name="netmask" value="#{systemProperties['jetstream.runtime.netmask'] ?: '127.0.0.1/8'}" />
<property name="connectionPoolSz" value="1" />
<property name="maxNettyBackLog" value="20000" />
<property name="idleTimeoutInSecs" value="8640000"/>
<property name="enableCompression" value="false" />
<property name="tcpKeepAlive" value="true"/>
</bean>
</list>
</property>
<property name="upstreamDispatchQueueSize" value="300000" />
<property name="upstreamDispatchThreadPoolSize" value="2" />
</bean>
A scheduler can be optionally injected to this context binding it to a specific QOS. If scheduler is not specified, default scheduler is weighted round robin scheduler. The “MessageServiceProperties” bean is applied at run time and can be changed at runtime.
- Every application that wires in either InboundMessagingChannel or OutboundMessagingChannel bean is required to provision MessageService bean.
<bean id="MessageService"
class="com.ebay.jetstream.messaging.config.MessageServiceConfiguration"
depends-on="SystemPropertiesConfiguration">
<property name="messageServiceProperties" ref="MessageServiceProperties" />
</bean>
[Next: Run the application] (../wiki/Get-Set-Run)