org.hornetq.api.core.client
Interface ClientSessionFactory


public interface ClientSessionFactory

A ClientSessionFactory is the entry point to create and configure HornetQ resources to produce and consume messages.
It is possible to configure a factory using the setter methods only if no session has been created. Once a session is created, the configuration is fixed and any call to a setter method will throw a IllegalStateException.

Author:
Tim Fox

Method Summary
 void close()
           
 ClientSession createSession()
          Creates a non-transacted session.
 ClientSession createSession(boolean autoCommitSends, boolean autoCommitAcks)
          Creates a session.
 ClientSession createSession(boolean xa, boolean autoCommitSends, boolean autoCommitAcks)
          Creates a session.
 ClientSession createSession(boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge)
          Creates a session.
 ClientSession createSession(boolean autoCommitSends, boolean autoCommitAcks, int ackBatchSize)
          Creates a session.
 ClientSession createSession(String username, String password, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge, int ackBatchSize)
          Creates an authenticated session.
 ClientSession createTransactedSession()
          Creates a transacted session.
 ClientSession createXASession()
          Creates a session with XA transaction semantics.
 org.hornetq.core.protocol.core.CoreRemotingConnection getConnection()
           
 ServerLocator getServerLocator()
           
 

Method Detail

createXASession

ClientSession createXASession()
                              throws HornetQException
Creates a session with XA transaction semantics.

Returns:
a ClientSession with XA transaction semantics
Throws:
HornetQException - if an exception occurs while creating the session

createTransactedSession

ClientSession createTransactedSession()
                                      throws HornetQException
Creates a transacted session. It is up to the client to commit when sending and acknowledging messages.

Returns:
a transacted ClientSession
Throws:
HornetQException - if an exception occurs while creating the session
See Also:
ClientSession.commit()

createSession

ClientSession createSession()
                            throws HornetQException
Creates a non-transacted session. Message sends and acknowledgements are automatically committed by the session. This does not mean that messages are automatically acknowledged, only that when messages are acknowledged, the session will automatically commit the transaction containing the acknowledgements.

Returns:
a non-transacted ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

createSession

ClientSession createSession(boolean autoCommitSends,
                            boolean autoCommitAcks)
                            throws HornetQException
Creates a session.

Parameters:
autoCommitSends - true to automatically commit message sends, false to commit manually
autoCommitAcks - true to automatically commit message acknowledgement, false to commit manually
Returns:
a ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

createSession

ClientSession createSession(boolean autoCommitSends,
                            boolean autoCommitAcks,
                            int ackBatchSize)
                            throws HornetQException
Creates a session.

Parameters:
autoCommitSends - true to automatically commit message sends, false to commit manually
autoCommitAcks - true to automatically commit message acknowledgement, false to commit manually
ackBatchSize - the batch size of the acknowledgements
Returns:
a ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

createSession

ClientSession createSession(boolean xa,
                            boolean autoCommitSends,
                            boolean autoCommitAcks)
                            throws HornetQException
Creates a session.

Parameters:
xa - whether the session support XA transaction semantic or not
autoCommitSends - true to automatically commit message sends, false to commit manually
autoCommitAcks - true to automatically commit message acknowledgement, false to commit manually
Returns:
a ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

createSession

ClientSession createSession(boolean xa,
                            boolean autoCommitSends,
                            boolean autoCommitAcks,
                            boolean preAcknowledge)
                            throws HornetQException
Creates a session. It is possible to pre-acknowledge messages on the server so that the client can avoid additional network trip to the server to acknowledge messages. While this increase performance, this does not guarantee delivery (as messages can be lost after being pre-acknowledged on the server). Use with caution if your application design permits it.

Parameters:
xa - whether the session support XA transaction semantic or not
autoCommitSends - true to automatically commit message sends, false to commit manually
autoCommitAcks - true to automatically commit message acknowledgement, false to commit manually
preAcknowledge - true to pre-acknowledge messages on the server, false to let the client acknowledge the messages
Returns:
a ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

createSession

ClientSession createSession(String username,
                            String password,
                            boolean xa,
                            boolean autoCommitSends,
                            boolean autoCommitAcks,
                            boolean preAcknowledge,
                            int ackBatchSize)
                            throws HornetQException
Creates an authenticated session. It is possible to pre-acknowledge messages on the server so that the client can avoid additional network trip to the server to acknowledge messages. While this increase performance, this does not guarantee delivery (as messages can be lost after being pre-acknowledged on the server). Use with caution if your application design permits it.

Parameters:
username - the user name
password - the user password
xa - whether the session support XA transaction semantic or not
autoCommitSends - true to automatically commit message sends, false to commit manually
autoCommitAcks - true to automatically commit message acknowledgement, false to commit manually
preAcknowledge - true to pre-acknowledge messages on the server, false to let the client acknowledge the messages
Returns:
a ClientSession
Throws:
HornetQException - if an exception occurs while creating the session

close

void close()

getServerLocator

ServerLocator getServerLocator()

getConnection

org.hornetq.core.protocol.core.CoreRemotingConnection getConnection()


Copyright © 2009 Red Hat Inc. All Rights Reserved.