1 Reply Latest reply on Jan 5, 2011 5:43 PM by Gerald Turner

    What's the Right Way™ to fix missing JBoss Messaging secondaryBindPort with ServiceBindingsManager (AS5)

    Gerald Turner Newbie

      I have some [hundreds of] JBoss servers behind a NAT that need upgrading from 4.2 to 5.1.  Apparently JBoss Messaging out-of-the box is unfriendly with NAT because it requires some sections of deploy/messaging/remoting-bisocket-service.xml to be uncommented and configured (parameters: secondaryBindPort and secondaryConnectPort) otherwise clients are told to connect to random port numbers that the firewalls will deny.  Some servers have multiple JBoss instances running so we take advantage of ServiceBindingsManager.  Unfortunately I can't leap to 6.0 because that release lacks usable HA-JMS (too symetric, conf nightmare, recovery nightmare).

       

      Luckily one of the ports used by JBoss Messaging is configured statically, parameter serverBindPort with value ${jboss.messaging.connector.bisocket.port:4457}.  So it's using a System Property and it appears that the correct solution is to add tweak/add blocks of XML in conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml to expand on the SystemPropertyBinder feature already present with this existing property.

       

      Is the following configuration correct?

       

      Currently deploy/messaging/remoting-bisocket-service.xml contains StandardBindings section:

       

      <bean class="org.jboss.services.binding.ServiceBindingMetadata">
        <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
        <property name="port">4457</property>
        <property name="description">Socket for JBoss Messaging 1.x</property>
      </bean>


      …and SystemPropertyBinder section:


      <bean class="org.jboss.services.binding.SystemPropertyBinding">
        <constructor>
          <parameter>jboss.messaging.connector.bisocket.port</parameter>
          <parameter class="int">
            <value-factory bean="ServiceBindingManager" method="getIntBinding"
                           parameter="jboss.messaging:service=Connector,transport=bisocket"/>
          </parameter>
        </constructor>
      </bean>

       

      So I would have to modify these with a unique name and add two more properties:

       

      <bean class="org.jboss.services.binding.ServiceBindingMetadata">
        <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
        <property name="bindingName">serverBindPort</property>
        <property name="port">4457</property>
        <property name="description">Socket for JBoss Messaging 1.x</property>
      </bean>

       

      <bean class="org.jboss.services.binding.ServiceBindingMetadata">
        <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
        <property name="bindingName">secondaryBindPort</property>
        <property name="port">4458</property>
        <property name="description">Socket for JBoss Messaging 1.x (really?) remoting "control" port according to http://community.jboss.org/message/369189</property>
      </bean>

       

      <bean class="org.jboss.services.binding.ServiceBindingMetadata">
        <property name="serviceName">jboss.messaging:service=Connector,transport=bisocket</property>
        <property name="bindingName">secondaryConnectPort</property>
        <property name="port">4458</property>
        <property name="description">Socket for JBoss Messaging 1.x (really?) remoting "control" port for translating firewalls according to http://community.jboss.org/message/369189 (probably should be the same as secondaryBindPort?)</property>
      </bean>

       

      …and SystemPropertyBinder section:

       

      <bean class="org.jboss.services.binding.SystemPropertyBinding">
        <constructor>
          <parameter>jboss.messaging.connector.bisocket.port</parameter>
          <parameter class="int">
            <value-factory bean="ServiceBindingManager" method="getIntBinding">
              <parameter>jboss.messaging:service=Connector,transport=bisocket</parameter>
              <parameter>serverBindPort</parameter>
            </value-factory>

          </parameter>
        </constructor>
      </bean>

       

      <bean class="org.jboss.services.binding.SystemPropertyBinding">
        <constructor>
          <parameter>jboss.messaging.connector.bisocket.yet-another-port</parameter>
          <parameter class="int">
            <value-factory bean="ServiceBindingManager" method="getIntBinding">
              <parameter>jboss.messaging:service=Connector,transport=bisocket</parameter>
              <parameter>secondaryBindPort</parameter>
            </value-factory>
          </parameter>
        </constructor>
      </bean>

       

      <bean class="org.jboss.services.binding.SystemPropertyBinding">
        <constructor>
          <parameter>jboss.messaging.connector.bisocket.yet-another-another-port</parameter>
          <parameter class="int">
            <value-factory bean="ServiceBindingManager" method="getIntBinding">
              <parameter>jboss.messaging:service=Connector,transport=bisocket</parameter>
              <parameter>secondaryConnectPort</parameter>
            </value-factory>
          </parameter>
        </constructor>
      </bean>

       

      It would be really nice if a future > 5.1.0, < 6.0 release included such hack.