8.3. Bridge configuration

8.3. Bridge configuration

In this section we describe how to configure the message bridge

Here is an example of a message bridge configuration, with all the attributes shown. Note that some are commented out for this configuration, since it is not appropriate to specify them all at once. Which ones are specified depends on the configuration you want.

   <mbean code="org.jboss.jms.server.bridge.BridgeService"
          name="jboss.messaging:service=Bridge,name=TestBridge"
          xmbean-dd="xmdesc/Bridge-xmbean.xml">
          
      <!-- The JMS provider loader that is used to lookup the source destination -->   
      <depends optional-attribute-name="SourceProviderLoader">
          jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
      
      <!-- The JMS provider loader that is used to lookup the target destination -->
      <depends optional-attribute-name="TargetProviderLoader">
          jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>    
      
      <!-- The JNDI lookup for the source destination -->
      <attribute name="SourceDestinationLookup">/queue/A</attribute> 
      
      <!-- The JNDI lookup for the target destination -->
      <attribute name="TargetDestinationLookup">/queue/B</attribute>
      
      <!-- The username to use for the source connection 
      <attribute name="SourceUsername">bob</attribute>
      -->
      
      <!-- The password to use for the source connection
      <attribute name="SourcePassword">cheesecake</attribute>
      -->
      
      <!-- The username to use for the target connection
      <attribute name="TargetUsername">mary</attribute>
      -->
      
      <!-- The password to use for the target connection
      <attribute name="TargetPassword">hotdog</attribute>
      -->
      
      <!-- Optional: The Quality Of Service mode to use, one of:
           QOS_AT_MOST_ONCE = 0;
           QOS_DUPLICATES_OK = 1;
           QOS_ONCE_AND_ONLY_ONCE = 2; -->
      <attribute name="QualityOfServiceMode">0</attribute>
      
      <!-- JMS selector to use for consuming messages from the source
      <attribute name="Selector">specify jms selector here</attribute>
      -->
      
      <!-- The maximum number of messages to consume from the source
          before sending to the target -->
      <attribute name="MaxBatchSize">5</attribute>     
      
      <!-- The maximum time to wait (in ms) before sending a batch to the target
          even if MaxBatchSize is not exceeded.
           -1 means wait forever -->   
      <attribute name="MaxBatchTime">-1</attribute>
      
      <!-- If consuming from a durable subscription this is the subscription name
      <attribute name="SubName">mysub</attribute>
      -->
      
      <!-- If consuming from a durable subscription this is the client ID to use
      <attribute name="ClientID">myClientID</attribute>
      -->
      
      <!-- The number of ms to wait between connection retrues in the event connections
          to source or target fail -->
      <attribute name="FailureRetryInterval">5000</attribute>      
      
      <!-- The maximum number of connection retries to make in case of failure,
          before giving up -1 means try forever-->
      <attribute name="MaxRetries">-1</attribute>

      <!-- If true then the message id of the message before bridging will be added
          as a header to the message so it is available to the receiver. Can then be
          sent as correlation id to correlate in a distributed request-response -->
      <attribute name="AddMessageIDInHeader">false</attribute>
      
    </mbean>
      

We will now discuss each attribute