Connection factories

To enable JMS applications to establish connections with the message service, you can create queue connection factories for point-to-point messaging, topic connection factories for publish/subscribe messaging, and generic connection factories, which you can use to create connections for both types of messaging.

A JMS client application can also use a connection factory that has not been preconfigured—see “Looking up a connection factory”.

You can use the Management Console to add and configure connection factories.

StepsAdding a JMS connection factory

  1. In the Management Console, expand the Resources folder.

  2. To add a generic connection factory, select JMS Connection Factories; to add a queue connection factory, select JMS Queue Connection Factories; to add a topic connection factory, select JMS Topic Connection Factories.

  3. Right-click, and select Add.

  4. Enter a name for the connection factory, and select Finish.

StepsConfiguring JMS connection factories

  1. In the Management Console, expand the Resources folder.

  2. Select one of JMS Connection Factories, JMS Queue Connection Factories, or JMS Topic Connection Factories.

  3. Highlight the connection factory you want to configure.

  4. On the General tab, enter the connection factory properties described in Table 2-3.

    Table 2-3: Connection factory properties

    Property

    Datatype

    Default value

    Description

    Client ID

    string

    blank

    Optional. If a JMS client uses a connection factory with an unspecified clientID, the client use its TCP/IP host name as the clientID. If this is insufficient, either:

    • The client can call the javax.jms.Connection.setClientID method to set the clientID, or

    • The administrator can create a distinct connection factory for each client. Sybase does not recommended this method, as it can make the administrator unnecessarily busy.

    Command Batch Size

    long

    0

    Some communication between a JMS client and the JMS server can be batched to improve message throughput (possibly at the expense of increasing message delivery times). The commandBatchSize property allows you to configure the maximum number of commands in a batch. A value of 0 indicates that the client should supply its own value; for example, 20. Sybase recommends that you test different values to determine which value provides the best performance in your environment. Different client applications might benefit from different values. Values that are too large may cause a client to consume excessive amounts of memory. A reasonable starting value is 20.

    Command Batch Wait

    long

    1

    The maximum time (in milliseconds) that the client waits for a batch to fill up before sending it to the server, partially filled. The configuration property name is commandBatchWait.Sybase recommends that you test different values, to determine which value provides the best performance in your environment. Values that are too large may cause delays in message delivery. A reasonable starting value is 1 millisecond.

    Receive Batch Size

    long

    0

    A JMS client runtime may receive messages in batches to improve communication with the JMS server. If set to 0, clients must provide their own value. The configuration property name is receiveBatchSize.Sybase recommends that you test different values to determine which value provides the best performance in your environment. Values that are too large may cause a client to consume excessive amounts of memory. A reasonable starting value is 20.

    NoteIf a client receives only a small number of messages, then closes its connection, a value of 20 may be too large, because prefetched messages would need to be “unreceived.” In such cases, set the value to 1, then increase in small increments until you determine the best performance value.

    Temporary Queue Template

    string

    javax.jms.TemporaryQueue

    If a session associated with this connection factory creates a JMS temporary queue, the queue’s configuration properties are copied from this named queue. The configuration property name is temporaryQueueTemplate.

    Temporary Topic Template

    string

    javax.jms.TemporaryTopic

    If a session associated with this connection factory creates a JMS temporary topic, the topic’s configuration properties are copied from this named topic. The configuration property name is temporaryTopicTemplate.

    Batch Persistent Messages

    boolean

    false

    Select to enable client-side batching of persistent messages. This may improve throughput for applications that use transacted sessions, but should be used only if the client can resend (potentially) lost messages upon reconnection. The configuration property name is batchPersistentMessages.

    Within a transaction, if all a client’s sent messages are derived from messages that were received in the same transaction, you can safely enable this option, even though client failure might result in batched transaction commits not being sent to the server. This is because when a client restarts, messages that were previously received but not acknowledged are received again, and any lost transactions can be reissued.

    Batch Transaction Commits

    boolean

    false

    Select to enable client-side batching of transaction commits. This may improve throughput for applications that use transacted sessions, but should be used only if the client can resend (potentially) lost messages upon reconnection. The configuration property name is batchTransactionCommits.

    Within a single transaction, if all of a client’s sent messages are derived from messages received in the same transaction, then this option can be safely enabled, even though client failure can result in batched-transaction commits not being sent to the server. This is because upon client restart, messages that were previously received but not acknowledged are received again, and any lost transactions can be reissued.

    Disable Transient Exceptions

    boolean

    false

    To optimize the performance of a JMS application, set to false. The configuration property name is disableTransientExceptions.

    Transient exceptions occur when the JMS client runtime determines that the failure or restart of a server may have resulted in the loss of some nonpersistent messages. If transient exceptions occur, the client can handle them, or you can install an exception listener (using the javax.jms.Connection.setExceptionListener method) to handle them.

    If clients do not care about losing nonpersistent messages, set to true.