JMS QueueConnectionFactory vs ConnectionFactory

My question is regarding the use of the following two plants:

  • ConnectionFactory
  • QueueConnectionFactory

Right now, I'm just using ConnectionFactory to initialize everything:

 Connection conn = factory.createConnection(user, pw); Session session = conn.createSession() Destination dest = session.createQueue('xyz') ... 

If I understand correctly, QueueConnectionFactory works in much the same way. It is the same?

I am interested because I use a JNDI context that contains both objects. So I'm not sure which one I should use.

+5
source share
1 answer

The javax.jms package API says:

For historical reasons, JMS offers four alternative sets of interfaces for sending and receiving messages:

• JMS 1.0 defined two APIs for the domain, one for exchanging messages (queues) between points and one for pub / sub (themes). Although they remain part of the JMS for backward compatibility reasons, they should be considered completely replaced by later APIs.

• JMS 1.1 introduced a new unified API that offers one set of interfaces that can be used for both point-to-point and pub / sub messaging. This is called the classic API.

• JMS 2.0 is a simplified API that offers all the features of the classic API, but requires fewer interfaces and is easier to use.

Each API offers a different set of interfaces for connecting to a JMS provider and for sending and receiving messages. However, they all have a common set of interfaces for presenting messages and message recipients and for providing various useful functions.

In other words, QueueConnectionFactory is just an outdated interface.

+7
source

All Articles