# JmsSession.h File Reference

Describes a JmsSession handle. More...

`#include <JmsCommon.h>`
`#include <JmsBrowser.h>`
`#include <JmsConsumer.h>`
`#include <JmsDestination.h>`
`#include <JmsProducer.h>`
`#include <JmsQueue.h>`
`#include <JmsTopic.h>`
`#include <JmsTypes.h>`

Go to the source code of this file.

## Defines
#define | SESSION_TRANSACTED 0
#define | AUTO_ACKNOWLEDGE 1
#define | CLIENT_ACKNOWLEDGE 2
#define | DUPS_OK_ACKNOWLEDGE 3
## Typedefs
typedef JmsSession | JmsSession
## Functions
int JMSENTRY | JmsSessionGetTransacted (JmsSession *session, int *transacted, JMS64I flags)
int JMSENTRY | JmsSessionGetAcknowledgeMode (JmsSession *session, int *acknowledgeMode, JMS64I flags)
int JMSENTRY | JmsSessionCommit (JmsSession *session, JMS64I flags)
int JMSENTRY | JmsSessionRollback (JmsSession *session, JMS64I flags)
int JMSENTRY | JmsSessionClose (JmsSession *session, JMS64I flags)
int JMSENTRY | JmsSessionRecover (JmsSession *session, JMS64I flags)
int JMSENTRY | JmsSessionCreateProducer (JmsSession *session, JmsDestination *destination, JmsProducer **producer, JMS64I flags)
int JMSENTRY | JmsSessionCreateConsumer (JmsSession *session, JmsDestination *destination, JmsString *selector, int noLocal, JmsConsumer **consumer, JMS64I flags)
int JMSENTRY | JmsSessionCreateDurableSubscriber (JmsSession *session, JmsTopic *topic, JmsString *name, JmsString *selector, int noLocal, JmsConsumer **consumer, JMS64I flags)
int JMSENTRY | JmsSessionCreateBrowser (JmsSession *session, JmsQueue *queue, JmsString *selector, JmsBrowser **browser, JMS64I flags)
int JMSENTRY | JmsSessionUnsubscribe (JmsSession *session, JmsString *name, JMS64I flags)
int JMSENTRY | JmsSessionCreateTemporaryQueue (JmsSession *connection, JmsQueue **queue, JMS64I flags)
int JMSENTRY | JmsSessionCreateTemporaryTopic (JmsSession *connection, JmsTopic **topic, JMS64I flags)

## Detailed Description

Describes a JmsSession handle.

This file describes the functions that can be performed on a JmsSession handle A JmsSession handle corresponds to javax.jms.Session

Author:
  Copyright (c) 2002, BEA Systems, Inc.

## Define Documentation

#define AUTO_ACKNOWLEDGE 1

| The session's acknowledge mode is auto-acknowledge

#define CLIENT_ACKNOWLEDGE 2

| The session's acknowledge mode is client controlled

#define DUPS_OK_ACKNOWLEDGE 3

| The session's acknowledge mode is duplicates ok

#define SESSION_TRANSACTED 0

| The session's acknowledge mode is transacted

## Typedef Documentation

typedef struct JmsSession JmsSession

| A session handle that represents the class javax.jms.Session

## Function Documentation

int JMSENTRY JmsSessionClose | ( | JmsSession * | session,
|  | JMS64I | flags
| ) |

  | Closes the session. Since a provider may allocate some resources on behalf of a session outside the JVM, clients should close the resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough. Unlike in java, the producers and consumers of a closed session must be explicitly closed. This call will block until a receive call or message listener in progress has completed. A blocked message consumer receive call returns null when this session is closed. Closing a transacted session must roll back the transaction in progress. This method is the only Session method that can be called concurrently. Invoking any other Session method on a closed session has undefined behaviour. Closing a closed session also has undefined behaviour. This behaviour is different from the Java behavior. After a call to this function the session handle is no longer valid and should not be referenced Parameters:
  session | Must be a valid session handle. May not be NULL
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCommit | ( | JmsSession * | session,
|  | JMS64I | flags
| ) |

  | Commits all messages done in this transaction and releases any locks currently held Parameters:
  session | Must be a valid session handle. May not be NULL
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateBrowser | ( | JmsSession * | session,
|  | JmsQueue * | queue,
|  | JmsString * | selector,
|  | JmsBrowser ** | browser,
|  | JMS64I | flags
| ) |

  | Creates a valid browser handle for the given queue from the given session handle Parameters:
  session | Must be a valid session handle. May not be NULL
  queue | Must be a valid topic handle. May not be NULL
  selector | The selector to use when receiving messages from this queue. If NULL, all messages from the destination are selected
  browser | May not be NULL. On success, *browser will contain a valid browser handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateConsumer | ( | JmsSession * | session,
|  | JmsDestination * | destination,
|  | JmsString * | selector,
|  | int | noLocal,
|  | JmsConsumer ** | consumer,
|  | JMS64I | flags
| ) |

  | Creates a valid consumer handle for the given destination from the given session handle Parameters:
  session | Must be a valid session handle. May not be NULL
  destination | Must be a valid destination handle. May not be NULL
  selector | The selector to use when receiving messages from this destination. If NULL, all messages from the destination are selected
  noLocal | if non zero, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for noLocal is not specified if the destination is a queue.
  consumer | May not be NULL. On success, *consumer will contain a valid consumer handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateDurableSubscriber | ( | JmsSession * | session,
|  | JmsTopic * | topic,
|  | JmsString * | name,
|  | JmsString * | selector,
|  | int | noLocal,
|  | JmsConsumer ** | consumer,
|  | JMS64I | flags
| ) |

  | Creates a valid consumer handle for the given topic from the given session handle. The subscription created is durable Parameters:
  session | Must be a valid session handle. May not be NULL
  topic | Must be a valid topic handle. May not be NULL
  name | The name of the durable subscription
  selector | The selector to use when receiving messages from this topic. If NULL, all messages from the destination are selected
  noLocal | if non zero inhibits the delivery of messages published by its own connection
  consumer | May not be NULL. On success, *consumer will contain a valid consumer handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateProducer | ( | JmsSession * | session,
|  | JmsDestination * | destination,
|  | JmsProducer ** | producer,
|  | JMS64I | flags
| ) |

  | Creates a valid producer handle for the given destination from the given session handle Parameters:
  session | Must be a valid session handle. May not be NULL
  destination | Must be a valid destination handle. May not be NULL
  producer | May not be NULL. On success, *producer will contain a valid producer handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateTemporaryQueue | ( | JmsSession * | connection,
|  | JmsQueue ** | queue,
|  | JMS64I | flags
| ) |

  | Creates a temporary queue from the given session Parameters:
  session | Must be a valid session handle. May not be NULL
  queue | May not be NULL. On success, *queue will contain a valid queue handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionCreateTemporaryTopic | ( | JmsSession * | connection,
|  | JmsTopic ** | topic,
|  | JMS64I | flags
| ) |

  | Creates a temporary topic from the given session Parameters:
  session | Must be a valid session handle. May not be NULL
  topic | May not be NULL. On success, *queue will contain a valid topic handle
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionGetAcknowledgeMode | ( | JmsSession * | session,
|  | int * | acknowledgeMode,
|  | JMS64I | flags
| ) |

  | Returns the acknowledge mode of the session Parameters:
  session | Must be a valid session handle. May not be NULL
  acknowledgeMode | May not be NULL. On success, *acknowledgeMode will be set to the acknowledge mode of the session
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionGetTransacted | ( | JmsSession * | session,
|  | int * | transacted,
|  | JMS64I | flags
| ) |

  | Tells whether or not a session handle is transacted Parameters:
  session | Must be a valid session handle. May not be NULL
  transacted | May not be NULL. On success, *transacted will be zero if the session is not transacted and non-zero if the session is transacted
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionRecover | ( | JmsSession * | session,
|  | JMS64I | flags
| ) |

  | Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message. All consumers deliver messages in a serial order. Acknowledging a received message automatically acknowledges all messages that have been delivered to the client. Restarting a session causes it to take the following actions: Stop message delivery Mark all messages that might have been delivered but not acknowledged as "redelivered" Restart the delivery sequence including all unacknowledged messages that had been previously delivered. Redelivered messages do not have to be delivered in exactly their original delivery order. Parameters:
  session | Must be a valid session handle. May not be NULL
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionRollback | ( | JmsSession * | session,
|  | JMS64I | flags
| ) |

  | Rolls back any messages done in this transaction and releases any locks currently held Parameters:
  session | Must be a valid session handle. May not be NULL
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR

int JMSENTRY JmsSessionUnsubscribe | ( | JmsSession * | session,
|  | JmsString * | name,
|  | JMS64I | flags
| ) |

  | Destroys a durable subscription with the given name Parameters:
  session | Must be a valid session handle. May not be NULL
  name | The name of the subscription to destroy. May not be NULL
  flags | Reserved for future use. Must be zero
Returns: JMS_NO_ERROR JMS_GOT_EXCEPTION JMS_INPUT_PARAM_ERROR JMS_MALLOC_ERROR JMS_JVM_ERROR