5.3. Configuring the Post office
It is the job of the post office to route messages to their destination(s).
The post office maintains the mappings between addresses to which messages can be sent and their final queues.
For example when sending a message with an address that represents a JMS queue name, the post office will route this to a single queue - the JMS queue. When sending a message with an address that repesents a JMS topic name, the post office will route this to a set of queues - one for each JMS subscription.
The post office also handles the persistence for the mapping of addresses.
JBoss Messaging post-offices are also cluster aware. In a cluster they will automatically route and pull messages between them in order to provide fully distributed JMS queues and topics.
The post office configuration is found in the xxx-persistence-service.xml file (where xxx is the name of your database).
Here is an example of a post office configuration:
<mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
name="jboss.messaging:service=PostOffice"
xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
<depends optional-attribute-name="ServerPeer">
jboss.messaging:service=ServerPeer
</depends>
<depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
<depends optional-attribute-name="TransactionManager">
jboss:service=TransactionManager
</depends>
<!-- The name of the post office -->
<attribute name="PostOfficeName">JMS post office</attribute>
<!-- The datasource used by the post office to access it's binding information -->
<attribute name="DataSource">java:/DefaultDS</attribute>
<!-- If true will attempt to create tables and indexes on every start-up -->
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255),
NODE_ID INTEGER, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023),
SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1),
ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
ENGINE = INNODB
INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME,
COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
AND QUEUE_NAME=? LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR,
CHANNEL_ID, CLUSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=?
AND NODE_ID=?
]]></attribute>
<!-- This post office is clustered. If you don't want a clustered post office
then set to false -->
<attribute name="Clustered">true</attribute>
<!-- All the remaining properties only have to be specified if the post office
is clustered. You can safely comment them out if your post office is
non clustered -->
<!-- The JGroups group name that the post office will use -->
<attribute name="GroupName">MessagingPostOffice</attribute>
<!-- Max time to wait for state to arrive when the post office joins the cluster -->
<attribute name="StateTimeout">5000</attribute>
<!-- Max time to wait for a synchronous call to node members using
the MessageDispatcher -->
<attribute name="CastTimeout">50000</attribute>
<!-- Enable this when the JGroups multiplexer comes of age
<attribute name="ChannelFactoryName">jgroups.mux:name=Multiplexer</attribute>
<attribute name="ControlChannelName">udp-sync</attribute>
<attribute name="DataChannelName">udp</attribute>
<attribute name="ChannelPartitionName">
${jboss.partition.name:DefaultPartition}-JMS
</attribute>
-->
<!-- JGroups stack configuration for the data channel - used when casting
messages across the cluster -->
<attribute name="DataChannelConfig">
<config>
<UDP mcast_recv_buf_size="500000"
down_thread="false"
ip_mcast="true"
mcast_send_buf_size="32000"
mcast_port="45567"
ucast_recv_buf_size="500000"
use_incoming_packet_handler="false"
mcast_addr="228.8.8.8"
use_outgoing_packet_handler="true"
loopback="true"
ucast_send_buf_size="32000"
ip_ttl="32"/>
<AUTOCONF down_thread="false"
up_thread="false"/>
<PING timeout="2000"
down_thread="false"
num_initial_members="3"
up_thread="false"/>
... (truncated)
</config>
</attribute>
<!-- JGroups stack configuration to use for the control channel -
used for bind/unbind requests amongst others -->
<attribute name="ControlChannelConfig">
<config>
<UDP
mcast_recv_buf_size="500000"
down_thread="false"
ip_mcast="true"
mcast_send_buf_size="32000"
mcast_port="45568"
ucast_recv_buf_size="500000"
use_incoming_packet_handler="false"
mcast_addr="228.8.8.8"
use_outgoing_packet_handler="true"
loopback="true"
ucast_send_buf_size="32000"
ip_ttl="32"/>
<AUTOCONF down_thread="false"
up_thread="false"/>
<PING timeout="2000"
down_thread="false"
num_initial_members="3"
up_thread="false"/>
<MERGE2 max_interval="10000"
down_thread="false"
min_interval="5000"
up_thread="false"/>
... (truncated)
</config>
</attribute>
</mbean>