Class BrokerClient
- Direct Known Subclasses:
BrokerAdminClient
,BrokerTransactionalClient
Hostnames may include a ":port" on the end of them to indicate a specific (non-default) broker port.
Many calls say they can throw a "communications exception". These exceptions are:
-
- BrokerCommFailureException
- If a networking error occurs.
- BrokerConnectionClosedException
- If the broker disconnects from the application.
- BrokerFailureException
- If an error occurs on the broker which prevents the operation from being completed.
- BrokerProtocolException
- If an error occurs in communication between the broker and the application.
- BrokerTimeoutException
- If the request was not handled in a reasonable time. Most operations use the default timeout of 30 seconds.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
protected boolean
static final int
static final int
static final int
static final String
static final int
Default timeout for Broker requests.static final int
protected int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BrokerClient
(String broker_host, String broker_name, String client_id, BrokerConnectionDescriptor desc) Protected reconnect constructor.BrokerClient
(String broker_host, String broker_name, String client_id, String client_group, String app_name, BrokerConnectionDescriptor desc) Creates a client. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acknowledge
(long seqn) Acknowledge the single event specified.void
acknowledge
(long[] seqn) Acknowledge the array of events with the given seqn numbers.void
acknowledge
(long[] seqn, long txid) Acknowledge the array of events with the given seqn numbers, under the specified transaction id.void
acknowledge
(long seqn, long txid) Acknowledge the single event specified, under the specified transaction id.void
acknowledgeThrough
(long seqn) Acknowledges all events through the event specified.void
acknowledgeThrough
(long seqn, long txid) Acknowledges all events through the event specified, under the specified transaction id.int
beginAdapterTransaction
(String transaction_id, int required_level, String[] participants, boolean want_ack) Publishes an Adapter::beginTransaction event for the given transaction ID.browseEvents
(int from_index, int max_events, BrokerFilterDescriptor[] filters) Peek one or more events from the specified client's queue.void
cancelCallbackForSubId
(int sub_id) Cancel the client's specific callback for a subscription id.void
cancelCallbackForTag
(int tag) Cancel the client's specific callback for a tag value.void
Cancel all callbacks for the client.void
Cancel any pending check events request on the current client session.void
void
Cancel a subscription with matching event type and filter.void
cancelSubscription
(String event_type_name, String filter) Cancel a subscription with matching event type and filter.void
Cancel multiple subscriptions with matching event types and filters.boolean
canPublish
(String event_type_name) Test if can publish or deliver an event of a given type.boolean
canSubscribe
(String event_type_name) Test if can subscribe to an event type, or have events of that type delivered to this client.void
checkForEvents
(int msecs) Check for the availability of deliverable events on the client's queue.void
Clear all events from the client's queue.Creates a queue browser on the current client's queue.void
deliver
(String dest_id, BrokerEvent event) Deliver one event.void
deliver
(String dest_id, BrokerEvent[] events) Deliver multiple events.protected void
deliver
(String dest_id, BrokerEvent[] events, BrokerTransactionalClient tx_client) Deliver multiple events on the given transaction.protected void
deliver
(String dest_id, BrokerEvent event, BrokerTransactionalClient tx_client) Deliver one event in the given transaction.void
deliverAckReplyEvent
(BrokerEvent request_event, long publish_seqn) Delivers an Adapter::ack event to the originator of the specified event, which is most likely a request event.protected void
deliverAckReplyEvent
(BrokerEvent request_event, long publish_seqn, BrokerTransactionalClient tx_client) Delivers an Adapter::ack event to the originator of the specified event, which is most likely a request event for given transaction.void
deliverErrorReplyEvent
(BrokerEvent request_event, BrokerEvent error_event) /** Give a single error event to the broker to all be delivered to the client that published the 'request_event'.protected void
deliverErrorReplyEvent
(BrokerEvent request_event, BrokerEvent error_event, BrokerTransactionalClient tx_client) Give a single error event to the broker to all be delivered to the client that published the 'request_event' for given transaction.void
deliverNullReplyEvent
(BrokerEvent request_event, String reply_event_type_name, long publish_seqn) Delivers a null event of type 'reply_event_type_name' to the originator of the specified event, which is most likely a request event.protected void
deliverNullReplyEvent
(BrokerEvent request_event, String reply_event_type_name, long publish_seqn, BrokerTransactionalClient tx_client) Delivers a null event of type 'reply_event_type_name' to the originator of the specified event, which is most likely a request event for given transaction.int
deliverPartialReplyEvents
(BrokerEvent request_event, BrokerEvent[] events, int flag, int token) Give multiple events to the broker to all be delivered to the client that published the 'request_event'.protected int
deliverPartialReplyEvents
(BrokerEvent request_event, BrokerEvent[] events, int flag, int token, BrokerTransactionalClient tx_client) Give multiple events to the broker to all be delivered to the client that published the 'request_event' for the given transaction.void
deliverReplyEvent
(BrokerEvent request_event, BrokerEvent event) Give a single event to the broker to all be delivered to the client that published the 'request_event'.protected void
deliverReplyEvent
(BrokerEvent request_event, BrokerEvent event, BrokerTransactionalClient tx_client) Give a single event to the broker to all be delivered to the client that published the 'request_event' for the given transaction.void
deliverReplyEvents
(BrokerEvent request_event, BrokerEvent[] events) Give multiple events to the broker to all be delivered to the client that published the 'request_event'.void
deliverReplyEvents
(BrokerEvent request_event, BrokerEvent[] events, BrokerTransactionalClient tx_client) Give multiple events to the broker to all be delivered to the client that published the 'request_event' for given transaction.deliverRequestAndWait
(String dest_id, BrokerEvent event, int msecs) Deliver one request event and wait for replies.void
deliverWithAck
(String dest_id, BrokerEvent[] events, int ack_type, long[] ack_seqn) Deliver multiple events.protected void
deliverWithAck
(String dest_id, BrokerEvent[] events, int ack_type, long[] ack_seqn, BrokerTransactionalClient tx_client) Deliver multiple events on the given transaction.void
destroy()
Destroy the client.void
Disconnect the client.static void
dispatch
(int msecs) This function gets the next incoming event and passes it to the proper callback method.boolean
doesSubscriptionExist
(String event_type_name, String filter) Checks to see if the given subscription exists.int
endAdapterTransaction
(String transaction_id, int mode, boolean want_ack) Publishes an Adapter::endTransaction event for the given transaction ID.protected void
Ends the transactionprotected void
endTr
(long[] tx_ids, int tx_state) protected void
endTx
(long[] tx_ids, int tx_state) Ends the transactionprotected void
finalize()
Called by Java when you stop using this object.protected void
protected void
forgetTx
(long[] tx_ids) Forgets the transaction This can be called at any time, hence informing the broker that the the current transaction should be marked invalid.short[]
Get the access label for this client.Get the current api's version number.Get the client's application name.COM.activesw.api.client.BrokerAsyncExceptionListener
Returns the asynchronous Broker exception listner.Get the client's broker host name.Get the client's broker name.int
Get the client's broker host port.Get the secure socket certificate for the broker.int
Get the broker's version number.Get the broker's version string.String[]
Get the list of event type names which this client can publish or deliver.Get the definitions for the the event types this client can publish or deliver.String[]
Get the list of event type names which this client can subscribe to or have delivered to it.Get the definitions for the the event types this client can subscribe to or have delivered to it.Get the client's client group name.Get the client's identifier.Get the current client's information.Get the infoset for this client.int
Get the secure socket encryption level.Get the client's connection descriptor as used when this object was created.static int
Get the default port number for connecting to brokers.static int
Gets the current default timeout for Broker requests.getEvent
(int msecs) Gets a single event from this client's queue.protected BrokerEvent
getEvent
(int msecs, BrokerTransactionalClient tx_client) Gets a single event from this client's queue, that is part of the given open transaction context.boolean
getEvents
(int max_events, int msecs) Gets one or more events from this client's queue.protected BrokerEvent[]
getEvents
(int max_events, int msecs, BrokerTransactionalClient tx_client) Gets one or more events from this client's queue, that is a part of the the give open transaction context.getEvents
(int max_events, long seqn, int msecs) The sequence number is the event to acknowledge through.protected BrokerEvent[]
getEvents
(int max_events, long seqn, int msecs, BrokerTransactionalClient tx_client) This request gets processed only after the given BrokerTransactionalClient is is committed.getEventTypeDef
(String event_type_name) Get the specified event type's definition.getEventTypeDefs
(String[] event_type_names) Get the definitions for the requested event types.getEventTypeInfoset
(String event_type_name, String infoset_name) Get the specified infoset for the specified event type.String[]
getEventTypeInfosetNames
(String event_type_name) Get the list of infosets names for an event type.getEventTypeInfosets
(String event_type_name, String[] infoset_names) Get the requested infosets for the specified event type.String[]
Get the complete list of event type names from the broker.String[]
getEventTypeNames
(String scope_name) Get the list of event type names from the broker which are a member of the specified event type scope.COM.activesw.api.client.BrokerJMSEvent
COM.activesw.api.client.BrokerJMSEvent[]
getJMSEvents
(int max_events, long seqn, int msecs) protected COM.activesw.api.client.BrokerJMSEvent[]
getJMSEvents
(int max_events, long seqn, int msecs, BrokerTransactionalClient tx_client) long
Get the highest sequence number used by this client in a publish or deliver call.String[]
Get the list of event types which can be logged when clients of this client group acknowledges them.String[]
Get the list of event types that are logged when published by clients of this client's client group.static String
getPlatformInfo
(String key) Get a platform info value.static String[]
Get the list of platform info keys.int
Get the number of events currently in the client's queue.String[]
Get the complete list of event type scope names from the broker.Returns the active Broker Server Filter Collation locale.int
getSess()
System use only.Get the current filter used for event retrieval operations.int
Get the number of clients allowed to be connected using this client ID at one time.Get the list of open subscriptions.Get the territory name of the client's broker.protected int
getTxTimeout
(long tx_id) void
incrementRedeliveryCount
(long seqn) Increments the redelivery count on the single event specified.void
Interrupt any blocked awCheckForEvents call on the current client session.static void
Interrupt the current dispatch call.void
Interrupt the current getEvent call for the client.boolean
Check if any events are pending for the client.boolean
Check if connected.static boolean
Check if any events are pending for any client.void
jmsClientPublish
(COM.activesw.api.client.BrokerJMSEvent[] events, boolean async) protected void
jmsClientPublish
(COM.activesw.api.client.BrokerJMSEvent[] events, boolean async, BrokerTransactionalClient tx_client) static void
mainLoop()
A limited main loop which executes until told to stop.int
Generates a subscription id.int
makeTag()
Generate a unique value for use in the 'tag' envelope field.Generate a unique transaction ID for use in transaction operations.int
Generates a unique subscription id.void
negativeAcknowledge
(long seqn) Negative acknowledges the single event specified.void
negativeAcknowledge
(long[] seqn) Negative acknowledges the events specified.protected void
negativeAcknowledgeInternal
(long[] seqn, long tx_id) static BrokerClient
newOrReconnect
(String broker_host, String broker_name, String client_id, String client_group, String app_name, BrokerConnectionDescriptor desc) Attempts to create the client.void
newSubscription
(int sub_id, String event_type_name, String filter) Subscribe to all events of a given event type which match the specified filter.void
Subscribe to all events of a given event type.void
newSubscription
(String event_type_name, String filter) Subscribe to all events of a given event type which match the specified filter.void
newSubscriptions
(BrokerSubscription[] subs) Open multiple subscriptions at one time.protected long
Creates a transaction context that can be used to aggregate multiple publish and acknowledge operations into a single unit of work that can be committed or aborted atomically.void
ping()
Checks for network connectivity to the Broker using the default client timeout.void
ping
(int msecs) Checks for network connectivity to the Broker.static BrokerClientPoll[]
poll
(BrokerClientPoll[] polls, int msecs) Allows one or more clients to polled for pending operations, returning only after at least one client has a ready operation, the current thread is interrupted or the given timeout has expired.protected void
prepareExt
(String[] ext_ids) protected int
prepareTx
(long[] tx_ids) Prepares the transactionvoid
prime()
Tell the client to send a request for events but not block.void
prime
(int num) Tell the client to send a request for events but not block.protected void
prime
(int num, BrokerTransactionalClient tx_client) static void
Tell all clients to send a request for events but not block.static void
primeAllClients
(int num) Tell all clients to send a request for events but not block.void
primeWithAck
(int num) protected void
primeWithAck
(int num, BrokerTransactionalClient tx_client) void
publish
(BrokerEvent event) Publish one event.void
publish
(BrokerEvent[] events) Publish multiple events.protected void
publish
(BrokerEvent[] events, BrokerTransactionalClient tx_client) Publish multiple events on the given transaction.protected void
publish
(BrokerEvent event, BrokerTransactionalClient tx_client) Publish one event with the given transaction id.publishRequestAndWait
(BrokerEvent event, int msecs) Publish one request event to the broker and wait for replies.void
publishWithAck
(BrokerEvent[] events, int ack_type, long[] ack_seqn) Publish multiple events.protected void
publishWithAck
(BrokerEvent[] events, int ack_type, long[] ack_seqn, BrokerTransactionalClient tx_client) Publish multiple events for the given transaction.static BrokerClient
reconnect
(String broker_host, String broker_name, String client_id, BrokerConnectionDescriptor desc) Reconnects a client.protected String[]
recoverTx
(int flags, long lastTxID) void
registerCallback
(BrokerCallback obj, Object client_data) Register a general callback for events received by this client.void
registerCallbackForSubId
(int sub_id, BrokerCallback obj, Object client_data) Register a specific callback for events received by this client which matched a given subscription ID.void
registerCallbackForTag
(int tag, boolean cancel_when_done, BrokerCallback obj, Object client_data) Register a specific callback for events received by this client which have the _env.tag field set to the specified value.void
registerConnectionCallback
(BrokerConnectionCallback obj, Object client_data) Register a connection callback for this client.resendUnacknowledgedEvents
(long[] seqn) A list of events with the given "seqn" numbers will be sent to the broker again since they had not been acknowledged so far.void
Reset existing filters on the client session.void
setAsyncExceptionListener
(COM.activesw.api.client.BrokerAsyncExceptionListener listener) Registers an asynchronous Broker exception listener.void
setAutomaticControlLabel
(boolean enabled) Enable or disable automatic setting of the _env.controlLabel field.void
setClientInfoset
(BrokerEvent infoset) Set the infoset for this client.static int
setDefaultClientTimeout
(int msecs) Set the default timeout for broker requests.static void
setPlatformInfo
(String key, String value) Set a platform info value.void
Set filter for event retrieval operations.void
setSessionFilters
(BrokerFilterDescriptor[] filter) Set filters for event retrieval operations.void
setStateShareLimit
(int limit) Set the number of clients which can be simultaneously connected using this client ID.protected void
Sets the Broker transaction's external identifier.protected void
setTxTimeout
(int seconds, long tx_id) static void
Interrupt the current mainLoop calls.static void
threadedCallbacks
(boolean enabled) A convenience method to run the mainLoop method on another thread.toString()
Returns a string with the client information in a form suitable for human viewing.
-
Field Details
-
VERSION_31
public static final int VERSION_31- See Also:
-
VERSION_40
public static final int VERSION_40- See Also:
-
VERSION_50
public static final int VERSION_50- See Also:
-
VERSION_60
public static final int VERSION_60- See Also:
-
VERSION_61
public static final int VERSION_61- See Also:
-
VERSION_62
public static final int VERSION_62- See Also:
-
VERSION_63
public static final int VERSION_63- See Also:
-
VERSION_64
public static final int VERSION_64- See Also:
-
VERSION_65
public static final int VERSION_65- See Also:
-
VERSION_66
public static final int VERSION_66- See Also:
-
VERSION_71
public static final int VERSION_71- See Also:
-
VERSION_80
public static final int VERSION_80- See Also:
-
VERSION_82
public static final int VERSION_82- See Also:
-
VERSION_90
public static final int VERSION_90- See Also:
-
VERSION_105
public static final int VERSION_105- See Also:
-
VERSION_1015
public static final int VERSION_1015- See Also:
-
VERSION_111
public static final int VERSION_111- See Also:
-
CURRENT_API_VERSION
-
REPLY_FLAG_START
public static final int REPLY_FLAG_START- See Also:
-
REPLY_FLAG_CONTINUE
public static final int REPLY_FLAG_CONTINUE- See Also:
-
REPLY_FLAG_END
public static final int REPLY_FLAG_END- See Also:
-
REPLY_FLAG_START_AND_END
public static final int REPLY_FLAG_START_AND_END- See Also:
-
CONNECT_STATE_DISCONNECTED
public static final int CONNECT_STATE_DISCONNECTED- See Also:
-
CONNECT_STATE_CONNECTED
public static final int CONNECT_STATE_CONNECTED- See Also:
-
CONNECT_STATE_RECONNECTED
public static final int CONNECT_STATE_RECONNECTED- See Also:
-
TRANSACTION_LEVEL_ANY
public static final int TRANSACTION_LEVEL_ANY- See Also:
-
TRANSACTION_LEVEL_PSEUDO
public static final int TRANSACTION_LEVEL_PSEUDO- See Also:
-
TRANSACTION_LEVEL_BASIC
public static final int TRANSACTION_LEVEL_BASIC- See Also:
-
TRANSACTION_LEVEL_CONVERSATIONAL
public static final int TRANSACTION_LEVEL_CONVERSATIONAL- See Also:
-
TRANSACTION_MODE_COMMIT
public static final int TRANSACTION_MODE_COMMIT- See Also:
-
TRANSACTION_MODE_ROLLBACK
public static final int TRANSACTION_MODE_ROLLBACK- See Also:
-
TRANSACTION_MODE_SAVEPOINT
public static final int TRANSACTION_MODE_SAVEPOINT- See Also:
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTDefault timeout for Broker requests. The value of this constant is 30000 milliseconds.- See Also:
-
TIME_INFINITE
public static final int TIME_INFINITE- See Also:
-
SYNCHRONOUS
public static final int SYNCHRONOUS- See Also:
-
DO_NOT_ACK
public static final int DO_NOT_ACK- See Also:
-
NO_SHARE_LIMIT
public static final int NO_SHARE_LIMIT- See Also:
-
RECEIVE_SYNCHRONOUS
public static final int RECEIVE_SYNCHRONOUS- See Also:
-
ACK_NONE
public static final int ACK_NONE- See Also:
-
ACK_AUTOMATIC
public static final int ACK_AUTOMATIC- See Also:
-
ACK_THROUGH
public static final int ACK_THROUGH- See Also:
-
ACK_SELECTIVE
public static final int ACK_SELECTIVE- See Also:
-
event_req_id
protected int event_req_id -
browser_open
protected boolean browser_open
-
-
Constructor Details
-
BrokerClient
public BrokerClient(String broker_host, String broker_name, String client_id, String client_group, String app_name, BrokerConnectionDescriptor desc) throws BrokerException Creates a client. 'broker_name' can be null to request the default broker. 'client_id' can be null to request the broker to create an identifier (usually used with destroy-on-disconnect clients). 'desc' can be null to create a default connection.- Throws:
BrokerClientExistsException
- If a client using the specified client ID already exists.BrokerCommFailureException
- If problems occur establishing the connection.BrokerHostNotFoundException
- If the specified host does not exist.BrokerInvalidClientIdException
- If the ID contains illegal characters.BrokerInvalidNameException
- If the app_name contains illegal characters.BrokerNoPermissionException
- If permission to join the specified client group is denied.BrokerNotRunningException
- If the host exists but no broker is running on that host.BrokerNullParameterException
- If broker_host, client_group, or app_name are null.BrokerSecurityException
- If a secure connection is attempted but is rejected by the broker.BrokerUnknownBrokerNameException
- If the specified broker does not exist. If broker_name is null, this indicates that there is no default broker.BrokerUnknownClientGroupException
- If the specified client group does not exist on the broker.BrokerException
-
BrokerClient
protected BrokerClient(String broker_host, String broker_name, String client_id, BrokerConnectionDescriptor desc) throws BrokerException Protected reconnect constructor. See reconnect() for details.- Throws:
BrokerException
-
-
Method Details
-
reconnect
public static BrokerClient reconnect(String broker_host, String broker_name, String client_id, BrokerConnectionDescriptor desc) throws BrokerException Reconnects a client. 'broker_name' can be null to request the default broker. 'desc' can be null to request a default connection. The state sharing flag in the descriptor is ignored by this call. Whether or not the client shares state can only be set when making a new client. For normal clients, only one active connection can be made to the broker for a given client_id, so an error can be returned on reconnect if the client_id is already in use. For clients with shared state, multiple reconnects to the client_id can be made, but an error can be returned if the share limit is exceeded.- Throws:
BrokerClientContentionException
- If the client ID is already in use by another client. For shared state clients, this means the maximum number of reconnects has been exceeded.BrokerCommFailureException
- If problems occur establishing the connection.BrokerHostNotFoundException
- If the specified host does not exist.BrokerNoPermissionException
- If permission to join the specified client group is denied.BrokerNotRunningException
- If the host exists but no broker is running on that host.BrokerNullParameterException
- If broker_host or client_id are null.BrokerSecurityException
- If a secure connection is attempted but is rejected by the broker.BrokerUnknownBrokerNameException
- If the specified broker does not exist. If broker_name is null, this indicates that there is no default broker.BrokerUnknownClientIdException
- If the specified client ID does not exist on the broker.BrokerException
-
newOrReconnect
public static BrokerClient newOrReconnect(String broker_host, String broker_name, String client_id, String client_group, String app_name, BrokerConnectionDescriptor desc) throws BrokerException Attempts to create the client. If the creation fails because the client already exists, then it reconnects to the client instead. 'broker_name' can be null to request the default broker. 'desc' can be null to request a default connection. The state sharing flag in the descriptor is ignored if the client already exists. Whether or not the client shares state can only be set when making a new client.- Throws:
BrokerClientContentionException
- If the client ID is already in use by another client. For shared state clients, this means the maximum number of reconnects has been exceeded.BrokerCommFailureException
- If problems occur establishing the connection.BrokerHostNotFoundException
- If the specified host does not exist.BrokerInvalidClientIdException
- If the ID contains illegal characters.BrokerNoPermissionException
- If permission to join the specified client group is denied.BrokerNotRunningException
- If the host exists but no broker is running on that host.BrokerNullParameterException
- If broker_host, client_id, client_group, or app_name are null.BrokerSecurityException
- If a secure connection is attempted but is rejected by the broker.BrokerUnknownBrokerNameException
- If the specified broker does not exist. If broker_name is null, this indicates that there is no default broker.BrokerUnknownClientGroupException
- If the specified client group does not exist on the broker.BrokerUnknownClientIdException
- If the specified client ID does not exist on the broker.BrokerException
-
getBrokerHost
Get the client's broker host name. -
getBrokerPort
public int getBrokerPort()Get the client's broker host port. -
getTerritoryName
Get the territory name of the client's broker. Any communications exception can be thrown. Returns null if the client is not in a territory.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
getBrokerName
Get the client's broker name. Any communications exception can be thrown if the default broker was used in creating the client.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
getClientGroup
Get the client's client group name. -
getClientId
Get the client's identifier. -
getApplicationName
Get the client's application name. -
getBrokerVersionNumber
public int getBrokerVersionNumber()Get the broker's version number. Returns one of the VERSION_* contant values.If the broker is newer than the client's version, the client's version is reported.
-
getBrokerVersionString
Get the broker's version string.If the broker is newer than the client's version, the client's version is reported.
-
getApiVersionNumber
Get the current api's version number. Returns the CURRENT_API_VERSION's contant values. -
getConnectionDescriptor
Get the client's connection descriptor as used when this object was created. If null was passed to the descriptor argument, then a descriptor which matches the default behavior is returned. -
getClientInfo
Get the current client's information.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNoPermissionException
- If the client does not have permission to browse the specified client.BrokerNullParameterException
- If client_id is null.BrokerUnknownClientIdException
- If the client does not exist on the broker.BrokerException
-
destroy
Destroy the client. Removes the client from the broker. May throw any communications exception, but the local client object is marked as disconnected even if an exception is thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
disconnect
Disconnect the client. Deletes the local client object, but leaves the client state on the broker for future reconnects. Note that destroy-on-disconnect clients will destroy themselves when disconnect happens, so disconnect is identical to destroy in behavior for such clients. May throw any communications exception, but the local client object is marked as disconnected even if an exception is thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
finalize
protected void finalize()Called by Java when you stop using this object. Performs a disconnect(). Do not rely upon this method to disconnect your clients. -
ping
Checks for network connectivity to the Broker using the default client timeout. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
ping
Checks for network connectivity to the Broker. If 'msecs' is TIME_INFINITE (-1), it waits forever. In addition to the listed exceptions, any communications exception can be thrown.- Parameters:
msecs
- The amount of time, in milliseconds, to wait for a response from the Broker.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1.BrokerException
-
isConnected
public boolean isConnected()Check if connected. This is a passive check, meaning it only tells if the client has been explicitly destryed or disconnected, or if an error occurred on a previous call which indicated that the connection was closed. No active test of the connection is made. Returns true if the client is valid and is still connected, or false if not. -
toString
Returns a string with the client information in a form suitable for human viewing. -
canPublish
Test if can publish or deliver an event of a given type. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNullParameterException
- If event_type_name is null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
publish
Publish one event. The event is given to the broker to be given to all subscribing clients. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If event is null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
publish
protected void publish(BrokerEvent event, BrokerTransactionalClient tx_client) throws BrokerException Publish one event with the given transaction id. The event is given to the broker to be given to all subscribing clients. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If event is null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
publish
Publish multiple events. Gives an array of events to the broker to be given to subscribing clients. Either all of the events or none of them are published. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If events is null, or if any element in the array is null.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerException
-
jmsClientPublish
public void jmsClientPublish(COM.activesw.api.client.BrokerJMSEvent[] events, boolean async) throws BrokerException - Throws:
BrokerException
-
publish
protected void publish(BrokerEvent[] events, BrokerTransactionalClient tx_client) throws BrokerException Publish multiple events on the given transaction. Gives an array of events to the broker to be given to subscribing clients. Either all of the events or none of them are published. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If events is null, or if any element in the array is null.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerException
-
jmsClientPublish
protected void jmsClientPublish(COM.activesw.api.client.BrokerJMSEvent[] events, boolean async, BrokerTransactionalClient tx_client) throws BrokerException - Throws:
BrokerException
-
publishWithAck
public void publishWithAck(BrokerEvent[] events, int ack_type, long[] ack_seqn) throws BrokerException Publish multiple events. Gives an array of events to the broker to be given to subscribing clients. Either all of the events or none of them are published. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If events is null, or if any element in the array is null.BrokerOutOfRangeException
- If the ack_type is not a legal ACK_* value.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerInvalidAcknowledgementException
- If ack_seqn if not a valid event to acknowledge. Events are not published.BrokerException
-
publishWithAck
protected void publishWithAck(BrokerEvent[] events, int ack_type, long[] ack_seqn, BrokerTransactionalClient tx_client) throws BrokerException Publish multiple events for the given transaction. Gives an array of events to the broker to be given to subscribing clients. Either all of the events or none of them are published. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If events is null, or if any element in the array is null.BrokerOutOfRangeException
- If the ack_type is not a legal ACK_* value.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerInvalidAcknowledgementException
- If ack_seqn if not a valid event to acknowledge. Events are not published.BrokerException
-
deliver
Deliver one event. Gives an event to the broker to be given to the client with the given client ID. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If event or dest_id are null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
deliver
protected void deliver(String dest_id, BrokerEvent event, BrokerTransactionalClient tx_client) throws BrokerException Deliver one event in the given transaction. Gives an event to the broker to be given to the client with the given client ID. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If event or dest_id are null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
deliver
Deliver multiple events. Gives an array of events to the broker to have them all delivered to the client with the given client ID. Either all of the events or none of them are delivered. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If dest_id or events are null, or if any element in the array is null.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerException
-
deliver
protected void deliver(String dest_id, BrokerEvent[] events, BrokerTransactionalClient tx_client) throws BrokerException Deliver multiple events on the given transaction. Gives an array of events to the broker to have them all delivered to the client with the given client ID. Either all of the events or none of them are delivered. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If dest_id or events are null, or if any element in the array is null.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerException
-
deliverWithAck
public void deliverWithAck(String dest_id, BrokerEvent[] events, int ack_type, long[] ack_seqn) throws BrokerException Deliver multiple events. Gives an array of events to the broker to have them all delivered to the client with the given client ID. Either all of the events or none of them are delivered. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If dest_id or events are null, or if any element in the array is null.BrokerOutOfRangeException
- If the ack_type is not a legal ACK_* value.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerInvalidAcknowledgementException
- If ack_seqn if not a valid event to acknowledge. Events are not published.BrokerException
-
deliverWithAck
protected void deliverWithAck(String dest_id, BrokerEvent[] events, int ack_type, long[] ack_seqn, BrokerTransactionalClient tx_client) throws BrokerException Deliver multiple events on the given transaction. Gives an array of events to the broker to have them all delivered to the client with the given client ID. Either all of the events or none of them are delivered. No exception is thrown if there is no client using the destination client ID. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If any of the events does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish all of the event types.BrokerNullParameterException
- If dest_id or events are null, or if any element in the array is null.BrokerOutOfRangeException
- If the ack_type is not a legal ACK_* value.BrokerUnknownEventTypeException
- If the event type for any of the events does not exist on the broker.BrokerInvalidAcknowledgementException
- If ack_seqn if not a valid event to acknowledge. Events are not published.BrokerException
-
publishRequestAndWait
Publish one request event to the broker and wait for replies. Creates a value for the 'tag' envelope field using makeTag(). Blocks until the replies are received or until the requested timeout (TIME_INFINITE (-1) for infinite timeout) is reached. In addition to the listed exceptions, any communications exception can be thrown.Note: This operation is intended for use only for clients which are using the callback model. It does not work properly for clients which are using the getEvents model. It also only works properly when responses will be returned from only one client due to the request.
- Throws:
BrokerBadStateException
- If this is called from within a callback function.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If event is null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
deliverRequestAndWait
public BrokerEvent[] deliverRequestAndWait(String dest_id, BrokerEvent event, int msecs) throws BrokerException Deliver one request event and wait for replies. No exception is thrown if there is no client using the destination client ID. Creates a value for the 'tag' envelope field using makeTag(). Blocks until the replies are received or until the requested timeout (TIME_INFINITE (-1) for infinite timeout) is reached. In addition to the listed exceptions, any communications exception can be thrown.Note: This operation is intended for use only for clients which are using the callback model. It does not work properly for clients which are using the getEvents model. It also only works properly when responses will be returned from only one client due to the request.
- Throws:
BrokerBadStateException
- If this is called from within a callback function.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidClientIdException
- If the destination ID includes invalid characters.BrokerInvalidEventException
- If the event does not match its type definition.BrokerNoPermissionException
- If the client does not have permission to publish the event type.BrokerNullParameterException
- If dest_id or event are null.BrokerUnknownEventTypeException
- If the event type for the event does not exist on the broker.BrokerException
-
deliverAckReplyEvent
public void deliverAckReplyEvent(BrokerEvent request_event, long publish_seqn) throws BrokerException Delivers an Adapter::ack event to the originator of the specified event, which is most likely a request event. Properly sets the tag, trackId, activation and businessContext envelope fields to match that of the request. Properly uses the replyTo envelope field if set. Set publish_seqn to zero (0) when not using publish sequence numbers in your application. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event was not received from the broker.BrokerNoPermissionException
- If the client does not have permission to publish the Adapter::ack event type.BrokerNullParameterException
- If request_event is null.BrokerException
-
deliverAckReplyEvent
protected void deliverAckReplyEvent(BrokerEvent request_event, long publish_seqn, BrokerTransactionalClient tx_client) throws BrokerException Delivers an Adapter::ack event to the originator of the specified event, which is most likely a request event for given transaction. Properly sets the tag, trackId,businessContext and activation envelope fields to match that of the request. Properly uses the replyTo envelope field if set. Set publish_seqn to zero (0) when not using publish sequence numbers in your application. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event was not received from the broker.BrokerNoPermissionException
- If the client does not have permission to publish the Adapter::ack event type.BrokerNullParameterException
- If request_event is null.BrokerException
-
deliverNullReplyEvent
public void deliverNullReplyEvent(BrokerEvent request_event, String reply_event_type_name, long publish_seqn) throws BrokerException Delivers a null event of type 'reply_event_type_name' to the originator of the specified event, which is most likely a request event. Properly sets envelope tag, trackId, activation, businessContext, appSeqn, and appLastSeqn fields to indicate that this event is a null event. Properly uses the replyTo envelope field, if set. Null events are used to indicate that a request was successful and resulted in no data. Set publish_seqn to zero (0) when not using publish sequence numbers in your application. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event was not received from the broker.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or reply_event_type_name are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverNullReplyEvent
protected void deliverNullReplyEvent(BrokerEvent request_event, String reply_event_type_name, long publish_seqn, BrokerTransactionalClient tx_client) throws BrokerException Delivers a null event of type 'reply_event_type_name' to the originator of the specified event, which is most likely a request event for given transaction. Properly sets envelope tag, trackId, activation, businessContext, appSeqn, and appLastSeqn fields to indicate that this event is a null event. Properly uses the replyTo envelope field, if set. Null events are used to indicate that a request was successful and resulted in no data. Set publish_seqn to zero (0) when not using publish sequence numbers in your application. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the event was not received from the broker.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or reply_event_type_name are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverErrorReplyEvent
public void deliverErrorReplyEvent(BrokerEvent request_event, BrokerEvent error_event) throws BrokerException /** Give a single error event to the broker to all be delivered to the client that published the 'request_event'. No exception is thrown if there is no client using the destination clent ID. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the errorsTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or the reply event does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or event are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverErrorReplyEvent
protected void deliverErrorReplyEvent(BrokerEvent request_event, BrokerEvent error_event, BrokerTransactionalClient tx_client) throws BrokerException Give a single error event to the broker to all be delivered to the client that published the 'request_event' for given transaction. No exception is thrown if there is no client using the destination clent ID. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the errorsTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or the reply event does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or event are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverReplyEvent
Give a single event to the broker to all be delivered to the client that published the 'request_event'. No exception is thrown if there is no client using the destination clent ID. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or the reply event does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or event are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverReplyEvent
protected void deliverReplyEvent(BrokerEvent request_event, BrokerEvent event, BrokerTransactionalClient tx_client) throws BrokerException Give a single event to the broker to all be delivered to the client that published the 'request_event' for the given transaction. No exception is thrown if there is no client using the destination clent ID. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or the reply event does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish the reply event type.BrokerNullParameterException
- If request_event or event are null.BrokerUnknownEventTypeException
- If the event type for the reply event does not exist on the broker.BrokerException
-
deliverReplyEvents
public void deliverReplyEvents(BrokerEvent request_event, BrokerEvent[] events) throws BrokerException Give multiple events to the broker to all be delivered to the client that published the 'request_event'. No exception is thrown if there is no client using the destination client ID. Either all of the events or none of them are delivered. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or any of the reply events does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish all of the reply events.BrokerNullParameterException
- If request_event or events are null, or if any element in the events array is null.BrokerUnknownEventTypeException
- If the event type for any of the reply events does not exist on the broker.BrokerException
-
deliverReplyEvents
public void deliverReplyEvents(BrokerEvent request_event, BrokerEvent[] events, BrokerTransactionalClient tx_client) throws BrokerException Give multiple events to the broker to all be delivered to the client that published the 'request_event' for given transaction. No exception is thrown if there is no client using the destination client ID. Either all of the events or none of them are delivered. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or any of the reply events does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish all of the reply events.BrokerNullParameterException
- If request_event or events are null, or if any element in the events array is null.BrokerUnknownEventTypeException
- If the event type for any of the reply events does not exist on the broker.BrokerException
-
deliverPartialReplyEvents
public int deliverPartialReplyEvents(BrokerEvent request_event, BrokerEvent[] events, int flag, int token) throws BrokerException Give multiple events to the broker to all be delivered to the client that published the 'request_event'. No exception is thrown if there is no client using the destination client ID. Either all of the events or none of them are delivered. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. This function is used to deliver parts of a set of replies in groups. When called the first time, 'flag' should be REPLY_FLAG_START. After doing this, additional calls can be made with other flag values. During intermediate replies, 'flag' should be REPLY_FLAG_CONTINUE. On the final call, 'flag' should be REPLY_FLAG_END. Calling this function with 'flag' as REPLY_FLAG_START_AND_END allows the entire result to be passed to this function in one call. The 'token' parameter is ignored on REPLY_FLAG_START and REPLY_FLAG_START_AND_END. On other calls, the return value from the previous call should be passed. The return value exists to carry information between calls and has no meaning to the caller. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or any of the reply events does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish all of the reply events.BrokerNullParameterException
- If request_event or events are null, or if any element in the events array is null.BrokerOutOfRangeException
- If flag is not a valid value.BrokerUnknownEventTypeException
- If the event type for any of the reply events does not exist on the broker.BrokerException
-
deliverPartialReplyEvents
protected int deliverPartialReplyEvents(BrokerEvent request_event, BrokerEvent[] events, int flag, int token, BrokerTransactionalClient tx_client) throws BrokerException Give multiple events to the broker to all be delivered to the client that published the 'request_event' for the given transaction. No exception is thrown if there is no client using the destination client ID. Either all of the events or none of them are delivered. Properly sets the tag, trackId, activation, businessContext, appSeqn, and appLastSeqn envelope fields. Properly uses the replyTo envelope field, if set. This function is used to deliver parts of a set of replies in groups. When called the first time, 'flag' should be REPLY_FLAG_START. After doing this, additional calls can be made with other flag values. During intermediate replies, 'flag' should be REPLY_FLAG_CONTINUE. On the final call, 'flag' should be REPLY_FLAG_END. Calling this function with 'flag' as REPLY_FLAG_START_AND_END allows the entire result to be passed to this function in one call. The 'token' parameter is ignored on REPLY_FLAG_START and REPLY_FLAG_START_AND_END. On other calls, the return value from the previous call should be passed. The return value exists to carry information between calls and has no meaning to the caller. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidEventException
- If the request event was not received from the broker, or any of the reply events does not match its event type.BrokerNoPermissionException
- If the client does not have permission to publish all of the reply events.BrokerNullParameterException
- If request_event or events are null, or if any element in the events array is null.BrokerOutOfRangeException
- If flag is not a valid value.BrokerUnknownEventTypeException
- If the event type for any of the reply events does not exist on the broker.BrokerException
-
beginAdapterTransaction
public int beginAdapterTransaction(String transaction_id, int required_level, String[] participants, boolean want_ack) throws BrokerException Publishes an Adapter::beginTransaction event for the given transaction ID. After sending this event, the application can send any number of additional events with the "_env.transactionId" field set to the specified transaction ID. When it is done, it should use the endTransaction() method to close the transaction. required_level should be set to one of the TRANSACTION_LEVEL_* values. If set to something other than TRANSACTION_LEVEL_ANY, adapters which do not support the required level should generate an error on the first event they receive from this transaction. participants can be null. If any participants are specified, then only those clients should interact with the request events. These are usually adapter names. If want_ack is false, this function returns 0. Otherwise, it returns the value of the tag used in the beginTransaction event. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNoPermissionException
- If the client does not have permission to publish the Adapter::beginTransaction event type.BrokerNullParameterException
- If transaction_id is null, or if any entry in participants is null.BrokerException
-
endAdapterTransaction
public int endAdapterTransaction(String transaction_id, int mode, boolean want_ack) throws BrokerException Publishes an Adapter::endTransaction event for the given transaction ID. The mode should be one of the TRANSACTION_MODE_* values. This method should be used in conjunction with the beginAdapterTransaction() method. If want_ack is false, this function returns 0. Otherwise, a new tag is generated, used in the Adapter::endTransaction event and returned by this function. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNoPermissionException
- If the client does not have permission to publish the Adapter::endTransaction event type.BrokerNullParameterException
- If transaction_id is null.BrokerOutOfRangeException
- If mode is not a legal value.BrokerException
-
getLastPublishSequenceNumber
Get the highest sequence number used by this client in a publish or deliver call. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
canSubscribe
Test if can subscribe to an event type, or have events of that type delivered to this client. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNullParameterException
- If event_type_name is null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
newSubscription
Subscribe to all events of a given event type which match the specified filter. The subscription id defaults to zero. 'null' can be passed to the filter parameter if you do not wish to filter the events. If a subscription with the same name and filter already exists on the broker, the new subscription request is ignored. You can use doesSubscriptionExist() to test for existing subscriptions. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If the filter string contains a parse error.BrokerNoPermissionException
- If the client does not have permission to subscribe to the event type.BrokerNullParameterException
- If event_type_name is null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
newSubscription
public void newSubscription(int sub_id, String event_type_name, String filter) throws BrokerException Subscribe to all events of a given event type which match the specified filter. 'null' can be passed to the filter parameter if you do not wish to filter the events. If a subscription with the same name and filter already exists on the broker, the new subscription request is ignored. You can use doesSubscriptionExist() to test for existing subscriptions. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If the filter string contains a parse error.BrokerNoPermissionException
- If the client does not have permission to subscribe to the event type.BrokerNullParameterException
- If event_type_name is null.BrokerOutOfRangeException
- If sub_id is less than zero.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
newSubscription
Subscribe to all events of a given event type. 'null' can be stored in the filter field if you do not wish to filter the events. If a subscription with the same name and filter already exists on the broker, the new subscription request is ignored. You can use doesSubscriptionExist() to test for existing subscriptions. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If the filter string contains a parse error.BrokerNoPermissionException
- If the client does not have permission to subscribe to the event type.BrokerNullParameterException
- If sub.event_type_name is null.BrokerOutOfRangeException
- If sub.sub_id is less than zero.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
newSubscriptions
Open multiple subscriptions at one time. If a subscription with the same name and filter already exists on the broker, the new subscription request is ignored. You can use doesSubscriptionExist() to test for existing subscriptions. In addition to the listed exceptions, any communications exception can be thrown. NOTE that as many subscriptions as possible are created, so even when an error occurs, some subscriptions may have been created.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If any filter string contains a parse error.BrokerNoPermissionException
- If the client does not have permission to subscribe to all the event types.BrokerNullParameterException
- If subs is null, or if any of the subscription event_type_name fields are null.BrokerOutOfRangeException
- If any of the subscription's sub_id fields are less than zero.BrokerUnknownEventTypeException
- If any of the event types do not exist on the broker.BrokerException
-
cancelSubscription
Cancel a subscription with matching event type and filter. 'filter' may be null. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If there is no existing subscription that matches.BrokerNullParameterException
- If event_type_name is null.BrokerException
-
cancelSubscription
Cancel a subscription with matching event type and filter. The filter may be null. The sub_id field of the subscription object is ignored. Only the event type name and filter are used to find the matching subscription. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If there is no existing subscription that matches.BrokerNullParameterException
- If sub or sub.event_type_name are null.BrokerException
-
cancelSubscriptions
Cancel multiple subscriptions with matching event types and filters. The sub_id field of the subscription objects is ignored. Only the event type name and filter are used to find matching subscriptions. NOTE that as many subscriptions are cancelled as possible, so even when an exception occurs, some subscriptions may have been cancelled. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInvalidSubscriptionException
- If there is no existing subscription that matches one or more of the subscriptions.BrokerNullParameterException
- If subs is null, if any array element is null, or if any array element's event_type_name field is null.BrokerException
-
getSubscriptions
Get the list of open subscriptions. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
doesSubscriptionExist
Checks to see if the given subscription exists. The filter can be null. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
makeSubId
public int makeSubId()Generates a subscription id. This is only unique for subscriptions generated for this client during this execution. Use this for destroy-on-disconnect clients or explicit-destroy ones which do not already have open subscriptions. -
makeUniqueSubId
Generates a unique subscription id. This call first queries the broker for any open subscriptions, and then makes an ID that is unique. Use this for explicit-destroy clients which may have opened subscriptions previously. After calling this once, you may use makeSubId because this function initializes the setup for that function. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
makeTag
public int makeTag()Generate a unique value for use in the 'tag' envelope field. This field in used in request events to identify replies. -
makeTransactionId
Generate a unique transaction ID for use in transaction operations. Transaction IDs are formatted like "clientId:UniqueNumber:CountNumber". In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
checkForEvents
Check for the availability of deliverable events on the client's queue. Returns immediately if one or more events available on the queue, otherwise creates a pending check events request and blocks for a given number of milliseconds to be notified. If 'msecs' is TIME_INFINITE (-1), it waits forever. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInterruptedException
- If interruptCheckForEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.COM.activesw.api.client.BrokerInvalidOperationException
- If the client already has a pending check or get event requestBrokerOutOfRangeException
- If msecs is less than -1.BrokerTimeoutException
- If the timeout is reached before an event arrives.BrokerException
-
interruptCheckForEvents
Interrupt any blocked awCheckForEvents call on the current client session. This operation is intended for use in multi-threaded clients. This function is safe for use in a signal handler.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
cancelCheckForEvents
Cancel any pending check events request on the current client session. Any thread blocked on the checkForEvents call would be interrupted before canceling the check events request. This operation is intended for use in multi-threaded clients. This function is safe for use in a signal handler.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
cancelGetEvents
- Throws:
BrokerException
-
getEvent
Gets a single event from this client's queue. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either an event, or null if no events are available. Acknowledges all events which have been retrieved previously that were not explicitly acknowledged.Caution should be used when calling this method simultaneously from the same client on multiple threads. An event received on one thread may be acknowledged by another thread. To insure proper acknowledgement handling
getEvents(int, long, int)
should be used in this situation.In addition to the listed exceptions, any communications exception can be thrown.
- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1.BrokerTimeoutException
- If the timeout is reached before an event arrives.BrokerException
-
getEvent
protected BrokerEvent getEvent(int msecs, BrokerTransactionalClient tx_client) throws BrokerException Gets a single event from this client's queue, that is part of the given open transaction context. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either an event, or null if no events are available. Acknowledges all events which have been retrieved previously that were not explicitly acknowledged. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1.BrokerTimeoutException
- If the timeout is reached before an event arrives.BrokerException
-
getEvents
Gets one or more events from this client's queue. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either events, or an array length of zero if no events are available. Acknowledges all events which have been retrieved previously that were not explicitly acknowledged.Caution should be used when calling this method simultaneously from the same client on multiple threads. An event received on one thread may be acknowledged by another thread. To insure proper acknowledgement handling
getEvents(int, long, int)
should be used in this situation.The number of events being returned is not guaranteed to be 'max_events' even if there are more than than many events in the client's queue. Any number of events up to the value of 'max_events' may be returned. In addition to the listed exceptions, any communications exception can be thrown.
- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1, or max_events is less than zero.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
getEvents
protected BrokerEvent[] getEvents(int max_events, int msecs, BrokerTransactionalClient tx_client) throws BrokerException Gets one or more events from this client's queue, that is a part of the the give open transaction context. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either events, or an array length of zero if no events are available. Acknowledges all events which have been retrieved previously that were not explicitly acknowledged. The number of events being returned is not guaranteed to be 'max_events' even if there are more than than many events in the client's queue. Any number of events up to the value of 'max_events' may be returned. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1, or max_events is less than zero.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
getEvents
The sequence number is the event to acknowledge through. A value of zero acknowledges all events. A value of DO_NOT_ACK (-1) will not acknowledge any events. Gets one or more events from this client's queue. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either events, or an array length of zero if no events are available. Acknowledges all events up through the specified sequence number. If seqn is 0, then it acknowledges all events which have been retrieved previously that were not explicitly acknowledged. If seqn is DO_NOT_ACK (-1), then no events are acknowledged.Caution should be used when calling this method simultaneously from the same client on multiple threads when seqn is 0. An event received on one thread may be acknowledged by another thread.
The number of events being returned is not guaranteed to be 'max_events' even if there are more than than many events in the client's queue. Any number of events up to the value of 'max_events' may be returned. In addition to the listed exceptions, any communications exception can be thrown.
- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1, or max_events is less than zero, or seqn is less than -1.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
getJMSEvents
public COM.activesw.api.client.BrokerJMSEvent[] getJMSEvents(int max_events, long seqn, int msecs) throws BrokerException - Throws:
BrokerException
-
getEvents
protected BrokerEvent[] getEvents(int max_events, long seqn, int msecs, BrokerTransactionalClient tx_client) throws BrokerException This request gets processed only after the given BrokerTransactionalClient is is committed. If the given transaction is aborted this request will not be processed. The sequence number is the event to acknowledge through. A value of zero acknowledges all events. A value of DO_NOT_ACK (-1) will not acknowledge any events. Gets one or more events from this client's queue. Blocks for a given number of milliseconds then gives up. If 'msecs' is TIME_INFINITE (-1), it waits forever. If 'msecs' is SYNCHRONOUS (-2), it returns immediately with either events, or an array length of zero if no events are available. Acknowledges all events up through the specified sequence number. If seqn is 0, then it acknowledges all events which have been retrieved previously that were not explicitly acknowledged. If seqn is DO_NOT_ACK (-1), then no events are acknowledged. The number of events being returned is not guaranteed to be 'max_events' even if there are more than than many events in the client's queue. Any number of events up to the value of 'max_events' may be returned. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1, or max_events is less than zero, or seqn is less than -1.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
getJMSEvents
protected COM.activesw.api.client.BrokerJMSEvent[] getJMSEvents(int max_events, long seqn, int msecs, BrokerTransactionalClient tx_client) throws BrokerException - Throws:
BrokerException
-
browseEvents
public BrokerEvent[] browseEvents(int from_index, int max_events, BrokerFilterDescriptor[] filters) throws BrokerException Peek one or more events from the specified client's queue. Returns immediately with either events, or an array length of zero if no events are available. The number of events being returned is not guaranteed to be 'max_events' even if there are more than than many events in the client's queue. Any number of events up to the value of 'max_events' may be returned. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If the max_events or from_index is out of range.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
resendUnacknowledgedEvents
A list of events with the given "seqn" numbers will be sent to the broker again since they had not been acknowledged so far. The call returns an array of BrokerEvents which have been resent. This method does not have a timeout factor, waits until it resends all the events with the given seqn numbers. This is a new method and is only valid from 50 version of the Broker. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInterruptedException
- If interruptGetEvents is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If you have duplicate/invalid seqn#BrokerException
-
incrementRedeliveryCount
Increments the redelivery count on the single event specified. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If you have a negative seqn#COM.activesw.api.client.BrokerInvalidOperationException
- If you try to manually increment redelivery counts for a client that has automatic incrementsCOM.activesw.api.client.BrokerInvalidSequenceNumberException
- If you supply a sequence number that does not correspond to a received event.BrokerException
-
negativeAcknowledge
Negative acknowledges the single event specified. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If you have a negative seqn#COM.activesw.api.client.BrokerInvalidOperationException
- If you try to manually increment redelivery counts for a client that has automatic incrementsCOM.activesw.api.client.BrokerInvalidSequenceNumberException
- If you supply a sequence number that does not correspond to a received event.BrokerException
-
negativeAcknowledge
Negative acknowledges the events specified. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If you have a negative seqn#COM.activesw.api.client.BrokerInvalidOperationException
- If you try to manually increment redelivery counts for a client that has automatic incrementsCOM.activesw.api.client.BrokerInvalidSequenceNumberException
- If you supply a sequence number that does not correspond to a received event.BrokerException
-
negativeAcknowledgeInternal
- Throws:
BrokerException
-
interruptGetEvents
Interrupt the current getEvent call for the client. If there is no such call in progress, the next such call is interrupted. This operation is intended for use in multi-threaded clients.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
registerCallback
Register a general callback for events received by this client. Calling this on a client which already has an existing general callback will replace that callback. 'client_data' may be null.
The callback method will be called once if an event arrives which does not match a Tag callback, which has at least one subscription ID which does not match a SubId callback, or which is delivered to the application.
Use dispatch, mainLoop, or threadedCallbacks to make use of callbacks.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNullParameterException
- If obj is null.BrokerException
-
registerCallbackForSubId
public void registerCallbackForSubId(int sub_id, BrokerCallback obj, Object client_data) throws BrokerException Register a specific callback for events received by this client which matched a given subscription ID. Calling this on a client which already has an existing callback for the subscription ID will replace that callback. 'client_data' may be null.
Before calling this function, you must use registerCallback to register a general callback.
When using this call, it is suggested that each subscription be given a unique subscription ID.
The callback method will be called once if an event arrives which matched the specified subscription ID. It will be called more than once if the event matches the same subscription ID more than once. Note that it will never be called for events delivered to the client.- Throws:
BrokerBadStateException
- If no general callback has been registered.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNullParameterException
- If obj is null.BrokerOutOfRangeException
- If sub_id is less than zero.BrokerException
-
registerCallbackForTag
public void registerCallbackForTag(int tag, boolean cancel_when_done, BrokerCallback obj, Object client_data) throws BrokerException Register a specific callback for events received by this client which have the _env.tag field set to the specified value. Calling this on a client which already has an existing callback for the tag value will replace that callback. 'client_data' may be null.
If 'cancel_when_done' is true, then the callback will be automatically cancelled when isLastReplyEvent returns true. Otherwise, the callback will stay in effect until explicitly cancelled.
Before calling this function, you must use registerCallback to register a general callback.
The callback method will be called once if an event arrives which matches the specified tag value. Note that this is usually true only for events delivered to the client.- Throws:
BrokerBadStateException
- If no general callback has been registered.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNullParameterException
- If obj is null.BrokerException
-
cancelCallbacks
Cancel all callbacks for the client.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
cancelCallbackForSubId
Cancel the client's specific callback for a subscription id.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
cancelCallbackForTag
Cancel the client's specific callback for a tag value.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
poll
Allows one or more clients to polled for pending operations, returning only after at least one client has a ready operation, the current thread is interrupted or the given timeout has expired. It is not required that the clients be sharing connections. Passing in TIME_INFINITE (-1) will cause it to wait forever. In addition to the listed exceptions, any communications exception can be thrown.If one of the clients' requested operations is
BrokerClientPoll.GET_EVENTS
and there is not already an outstanding Broker event request thenprime(1)
will automatically be called for the client. If more than one event is required then it is the caller's responsibility to callprime
on each of the Broker clients with the required number of events.- Throws:
BrokerNullParameterException
- If polls is null.BrokerOutOfRangeException
- If msecs is less than -1.BrokerTimeoutException
- If the timeout is reached before any requested operations are ready.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerInterruptedException
- If the poll thread is interrupted.BrokerException
-
dispatch
This function gets the next incoming event and passes it to the proper callback method. Checks all clients which have callbacks registered. It blocks for the specified number of miliseconds one event has been processed. Passing in TIME_INFINITE (-1) will cause it to wait forever. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerBadStateException
- If this is called from within a callback function.BrokerInterruptedException
- If interruptDispatch is used to stop the call.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If msecs is less than -1.BrokerTimeoutException
- If the timeout is reached before any events arrive.BrokerException
-
interruptDispatch
Interrupt the current dispatch call. If there is no such call in progress, the next such call is interrupted. This operation is intended for use in multi-threaded clients.- Throws:
BrokerException
-
mainLoop
A limited main loop which executes until told to stop. It is logically equivalent to: "while(do_not_stop) { dispatch() };"
This function continues getting events and passing them to the proper callback methods. Checks all clients which have callbacks registered. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerBadStateException
- If this is called from within a callback function.BrokerException
-
stopMainLoop
Interrupt the current mainLoop calls. If there is no such call in progress, the next such call is interrupted. This operation is intended for use in multi-threaded clients or from within a callback method.- Throws:
BrokerException
-
threadedCallbacks
A convenience method to run the mainLoop method on another thread. The same method is used to enable (start the thread) and disable (shut down the thread). Do not call this method from inside a callback. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerException
-
isClientPending
Check if any events are pending for the client.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
isPending
Check if any events are pending for any client.- Throws:
BrokerException
-
prime
Tell the client to send a request for events but not block. Use this method on clients which have no callbacks and for which you intend to use isClientPending() to determine if events are waiting prior to calling getEvent(). Calling prime() is equivalent to calling prime(1). In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
prime
Tell the client to send a request for events but not block. Use this method on clients which have no callbacks and for which you intend to use isClientPending() to determine if events are waiting prior to calling getEvent(). If the requested number of events is less than one the number of events will default to one. In addition to the listed exceptions, any communications exception can be thrown.- Parameters:
num
- The requested number of events.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
primeWithAck
- Throws:
BrokerException
-
prime
- Throws:
BrokerException
-
primeWithAck
- Throws:
BrokerException
-
primeAllClients
Tell all clients to send a request for events but not block. Use this method if there are clients which have no callbacks and for which you intend to use isPending() or isClientPending() to determine if events are waiting prior to calling getEvent(). Calling primeAllClients() is equivalent to calling primeAllClients(1). Any communications exception can be thrown.- Throws:
BrokerException
-
primeAllClients
Tell all clients to send a request for events but not block. Use this method if there are clients which have no callbacks and for which you intend to use isPending() or isClientPending() to determine if events are waiting prior to calling getEvent(). Any communications exception can be thrown.- Parameters:
num
- The requested number of events.- Throws:
BrokerException
-
acknowledge
Acknowledge the single event specified. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
acknowledge
Acknowledge the single event specified, under the specified transaction id. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
acknowledge
Acknowledge the array of events with the given seqn numbers. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
acknowledge
Acknowledge the array of events with the given seqn numbers, under the specified transaction id. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
acknowledgeThrough
Acknowledges all events through the event specified. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
acknowledgeThrough
Acknowledges all events through the event specified, under the specified transaction id. A value of zero acknowledges all outstanding events. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidAcknowledgementException
- If seqn is not a valid event to acknowledge.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerOutOfRangeException
- If seqn is less than zero.BrokerException
-
getQueueLength
Get the number of events currently in the client's queue. This includes any unacknowledged events in the queue. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
clearQueue
Clear all events from the client's queue. Use with caution. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
getAccessLabel
Get the access label for this client. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerBadStateException
- If the client has an owner, but the access label feature is not enabled.BrokerFailureException
- If the client has an owner, but an error occurred looking up the access label.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerNoPermissionException
- If the client does not have an owner, so it cannot have an access label.BrokerException
-
getClientSSLEncryptionLevel
Get the secure socket encryption level. See BrokerConnectionDescriptor.ENCRYPT_LEVEL_* for values.- Throws:
BrokerBadStateException
- If the client is not using a secure socket connection.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
getBrokerSSLCertificate
Get the secure socket certificate for the broker.- Throws:
BrokerBadStateException
- If the client is not using a secure socket connection.BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-
getScopeNames
Get the complete list of event type scope names from the broker. Only lists the scopes which your client has permission to browse at least one event type from. A client normally can only browse event types which it can publish or subscribe to. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getEventTypeNames
Get the complete list of event type names from the broker. Only lists the event types which your client has permission to browse. A client normally can only browse event types which it can publish or subscribe to. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getEventTypeNames
Get the list of event type names from the broker which are a member of the specified event type scope. Only lists the event types which your client has permission to browse. A client normally can only browse event types which it can publish or subscribe to. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNullParameterException
- If scope_name is null.BrokerUnknownEventTypeException
- If no event types exist in the specified scope on the broker.BrokerException
-
getCanPublishNames
Get the list of event type names which this client can publish or deliver. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getCanSubscribeNames
Get the list of event type names which this client can subscribe to or have delivered to it. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getLogPublishNames
Get the list of event types that are logged when published by clients of this client's client group. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getLogAcknowledgeNames
Get the list of event types which can be logged when clients of this client group acknowledges them. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getEventLogging
- Throws:
BrokerException
-
getEventTypeDef
Get the specified event type's definition. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNoPermissionException
- If the client does not have permission to browse the event type. Normally a client has permission to browse an event type it can publish or subscribe to.BrokerNullParameterException
- If event_type_name is null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
getEventTypeDefs
Get the definitions for the requested event types. The returned array will be the same size as array passed in, and will either have a BrokerTypeDef or null in each entry. They will be null if the specified event type does not exist or if the client does not have permission to browse the event type. Normally a client has permission to browse event types it can publish or subscribe to. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNullParameterException
- If event_type_names or any entry in that array is null.BrokerException
-
getCanPublishTypeDefs
Get the definitions for the the event types this client can publish or deliver. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getCanSubscribeTypeDefs
Get the definitions for the the event types this client can subscribe to or have delivered to it. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getEventTypeInfoset
public BrokerEvent getEventTypeInfoset(String event_type_name, String infoset_name) throws BrokerException Get the specified infoset for the specified event type. The infoset itself is returned as an event for convenience. The infoset name is stored as the event's type name. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNoPermissionException
- If the infoset is not named "public" and the client does not have permission to publish or subscribe to the event type.BrokerNullParameterException
- If event_type_name or infoset_name are null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerUnknownInfosetException
- If the infoset does not exist on the specified event type in the broker.BrokerException
-
getEventTypeInfosets
public BrokerEvent[] getEventTypeInfosets(String event_type_name, String[] infoset_names) throws BrokerException Get the requested infosets for the specified event type. If infoset_names is null, all infosets are returned. The infosets are returned as events for convenience. The infoset names are stored as the event type names. The returned infosets array will contain null entries for infosets which do not exist on the event type, or for which permission is denied. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNullParameterException
- If event_type_name or infoset_name are null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
getEventTypeInfosetNames
Get the list of infosets names for an event type. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerNoPermissionException
- If the client does not have permission to publish or subscribe to the event type.BrokerNullParameterException
- If event_type_name is null.BrokerUnknownEventTypeException
- If the event type does not exist on the broker.BrokerException
-
getClientInfoset
Get the infoset for this client. The infoset is returned as an event object for convenience. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getJMSClientInfoset
- Throws:
BrokerException
-
setClientInfoset
Set the infoset for this client. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerInvalidEventTypeNameException
- If the infoset name includes colons.BrokerNullParameterException
- If infoset is null.BrokerException
-
setAutomaticControlLabel
Enable or disable automatic setting of the _env.controlLabel field. If set to true, the client's access label (if any) will be placed into the _env.controlLabel field if that field is not set before publishing. In addition to the listed exceptions, any communications exception can be thrown.- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
registerConnectionCallback
public void registerConnectionCallback(BrokerConnectionCallback obj, Object client_data) throws BrokerException Register a connection callback for this client. Calling this on a client which already has an existing callback will replace that callback. 'obj' may be null to clear the callback. 'client_data' may be null. The callback method will be called with connect_state set to CONNECT_STATE_DISCONNECTED if the client is disconnected. It will be called with CONNECT_STATE_CONNECTED if the client connection is re-established (only happens if automatic reconnect is enabled). It will be called with CONNECT_STATE_RECONNECTED if the disconnect is discovered, but the connection is re-established immediately (only happensif automatic reconnect is enabled).- Throws:
BrokerInvalidClientException
- If the client has been disconnected or destroyed.BrokerException
-
getDefaultBrokerPort
public static int getDefaultBrokerPort()Get the default port number for connecting to brokers. -
getDefaultTimeout
public static int getDefaultTimeout()Gets the current default timeout for Broker requests. Returns 30000 milliseconds by default unless the timeout is explicitly set to another value. -
setDefaultClientTimeout
public static int setDefaultClientTimeout(int msecs) Set the default timeout for broker requests. Returns the previous timeout value. -
getPlatformInfoKeys
Get the list of platform info keys. -
getPlatformInfo
Get a platform info value.- Throws:
BrokerNullParameterException
- If key is null.BrokerUnknownKeyException
- If the key does not exist in the platform info.BrokerException
-
setPlatformInfo
Set a platform info value. If a value was not previously defined for that key, the key is added to the platform information. Platform information is transmitted to the broker during new BrokerClient() and reconnectBrokerClient() operations.- Throws:
BrokerNoPermissionException
- If the key refers to read-only platform information.BrokerNullParameterException
- If key or value are null.BrokerException
-
getSess
public int getSess()System use only. Access session information. -
newTx
protected long newTx(String external_id, int existsFlag, long timeout, long tx_id) throws BrokerException Creates a transaction context that can be used to aggregate multiple publish and acknowledge operations into a single unit of work that can be committed or aborted atomically. If the transaction id is supplied, an external id and a timeout must also be supplied.- Parameters:
external_id
- (optional) A user defined transaction identifier- Returns:
- a transaction context
- Throws:
BrokerException
-
endTr
- Throws:
BrokerException
-
endTx
Ends the transaction- Parameters:
tx_ids
- the transaction identifierstx_state
- TX_END_COMMIT | TX_END_ABORT- Throws:
BrokerException
-
endExt
Ends the transaction- Parameters:
ext_ids
- the transaction identifierstx_state
- TX_END_COMMIT | TX_END_ABORT- Throws:
BrokerException
-
prepareExt
- Throws:
BrokerException
-
prepareTx
Prepares the transaction- Parameters:
tx_ids
- the transaction identifiers- Throws:
BrokerException
-
setTxId
Sets the Broker transaction's external identifier.- Parameters:
tx_id
- a Broker transaction identifierexternal_id
- an externally generated identifier- Throws:
BrokerInvalidTxException
- if the transaction is not found, the transaction is not open or if an external identifier already exists for the transaction.BrokerException
- for all other errors.
-
forgetTx
Forgets the transaction This can be called at any time, hence informing the broker that the the current transaction should be marked invalid.- Parameters:
tx_ids
- the transaction identifiers- Throws:
BrokerException
-
forgetExt
- Throws:
BrokerException
-
recoverTx
- Throws:
BrokerException
-
setTxTimeout
- Throws:
BrokerException
-
getTxTimeout
- Throws:
BrokerException
-
resetSessionFilters
Reset existing filters on the client session.- Throws:
BrokerInvalidClientException
- If the client has been destroyed.BrokerNoPermissionException
- If the client has limited access.BrokerNullParameterException
- If description is null.BrokerUnknownEventTypeException
- If no events exist in the specified scope on the broker.COM.activesw.api.client.BrokerInvalidFilterException
- If the specified filter expression is invalid.BrokerException
-
setSessionFilter
Set filter for event retrieval operations.- Throws:
BrokerInvalidClientException
- If the client has been destroyed.BrokerNoPermissionException
- If the client has limited access.BrokerNullParameterException
- If description is null.BrokerUnknownEventTypeException
- If no events exist in the specified scope on the broker.COM.activesw.api.client.BrokerInvalidFilterException
- If the specified filter expression is invalid.BrokerException
-
setSessionFilters
Set filters for event retrieval operations.- Throws:
BrokerInvalidClientException
- If the client has been destroyed.BrokerNoPermissionException
- If the client has limited access.BrokerNullParameterException
- If description is null.BrokerUnknownEventTypeException
- If no events exist in the specified scope on the broker.COM.activesw.api.client.BrokerInvalidFilterException
- If the specified filter expression is invalid.BrokerException
-
getSessionFilters
Get the current filter used for event retrieval operations.- Throws:
BrokerInvalidClientException
- If the client has been destroyed.BrokerFilterNotSetException
- If the client does not have any filter set for event retrieval operation.BrokerException
-
getServerFilterCollationLocale
Returns the active Broker Server Filter Collation locale.- Throws:
BrokerInvalidClientException
- If the client has been destroyed.BrokerNoPermissionException
- If the client has limited access.BrokerNullParameterException
- If description is null.BrokerInvalidNameException
- If the locale name is invalid.BrokerException
-
setAsyncExceptionListener
public void setAsyncExceptionListener(COM.activesw.api.client.BrokerAsyncExceptionListener listener) Registers an asynchronous Broker exception listener.- Parameters:
listener
- the exception listener
-
getAsyncExceptionListener
public COM.activesw.api.client.BrokerAsyncExceptionListener getAsyncExceptionListener()Returns the asynchronous Broker exception listner.- Returns:
- the exception listener
-
createClientQueueBrowser
Creates a queue browser on the current client's queue. This queue browser can be used to browse events from the queue without holding queue lock.- Returns:
- BrokerClientQueueBrowser object.
- Throws:
BrokerInvalidClientException
- If the client has been destroyed or disconnected.BrokerException
-