Can you set compression port on JMS client?

Options
arm
arm Member Posts: 15

When connecting to Solace via JMS JNDI LookUp with compression the lookup occurs over 55555 but the connection then connects of 55003. I have a network configuration where we port translate to multiple solace instances and trying to figure out how to map different servers to different ports but I can't seem to figure out how to set the compression port in the client. Is this possible or is it only set via the connection factory provided by solace?

Tagged:

Best Answer

  • arm
    arm Member Posts: 15
    #2 Answer ✓
    Options

    I think I figured it out. you have to overide the host value of the connection factory by calling setHost when the SolConnectionFactory is returned. This is the connection host and port that is used to establish the JMS connection. The URL you listed in the JNDI is only for the JNDI lookup.

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    Options

    I am not sure if I am understanding your question. In PubSub+ the JMS ports are the same as SMF in that the Solace JMS provider uses SMF as transport. Therefore the same ports are used. By default, 55003 is the SMF compression port.
    The ports for various services are set in the Broker Manager web UI under Services -> Settings (also CLI but Broker Manager is easiest).

    This is a self-managed broker, not Solace Cloud, correct?

  • arm
    arm Member Posts: 15
    Options

    When connective via JMS, JNDI lookup is performed over port 55555 and then when compression is set in the Connection Factory the connection is created over port 55003. So when passing the provider url in the JMS initial context you can’t set 55003 cause it fails to connect as it is expecting compression. So you can control the port in the provider url which is used in jndi lookup but is there a way to also set the port the client will try to connect the JMS compressed session?

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    Options

    Are you looking for this?

  • arm
    arm Member Posts: 15
    Options

    No, I don’t have access to the solace server to configure. I am trying to configure the JMS client and need to change the compression port that the client is using because we are performing port translation between the JMS client and the solace server.

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    Options

    The port can be in the JNDI Properties file as per the "tip" on the right. Does that help?

  • arm
    arm Member Posts: 15
    Options

    Do you have an example of the jndi property that needs to be set to control the compression port?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 935 admin
    Options

    Hey @arm,

    You can configure the port as part of the java.naming.provider.url. More info in our docs on this page (search for "java.naming.provider.url" to find it easier ;) ) https://docs.solace.com/Solace-JMS-API/JNDI-Connection-Properti.htm

  • arm
    arm Member Posts: 15
    #10 Answer ✓
    Options

    I think I figured it out. you have to overide the host value of the connection factory by calling setHost when the SolConnectionFactory is returned. This is the connection host and port that is used to establish the JMS connection. The URL you listed in the JNDI is only for the JNDI lookup.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 541 admin
    Options

    For completeness, and for others who aren't aware: when using the Solace broker as the JNDI lookup (rather than a separate external JNDI provider, as is more typical in production deployments) the Solace JMS API makes two client connections: one specifically for the JNDI connection factory lookup, and then a 2nd one for the actual data / messaging connection. You can see this if looking at the broker's event.log. It sounds like @arm was trying to figure out a way to ensure the initial JNDI connection (1st one) uses the compressed port 55003, not the default uncompressed 55555.

    BTW, @arm: why are you using the compressed port? Connecting over the WAN? Lots of easily compressible text payloads? Just curious, as using compression increases latency and CPU utilization, but can improve data throughput by being more efficient at network bandwidth.

  • arm
    arm Member Posts: 15
    Options

    @Aaron I am not trying to connect to JNDI over the compressed port but rather set the port used for the JMS Connection. The connection factory provided by JNDI uses the 55003 but we do port translation and needed to change this to a different port that we map to 55003 when doing the translation. For example, we connect to a solace service jndi via the client host smf://abd.com:1234 and then create the compressed connection via smf://abc.com:4321. The solace broker is configured to use ports 55555 and 55003. We have a server between the client and solace broker that routes traffic between the two and performs port translation of 1234 <> 55555 and 4321<>55003.