Package com.tibco.tibrv
Class TibrvJMSTransport
- java.lang.Object
-
- com.tibco.tibrv.TibrvTransport
-
- com.tibco.tibrv.TibrvNetTransport
-
- com.tibco.tibrv.TibrvJMSTransport
-
public class TibrvJMSTransport extends com.tibco.tibrv.TibrvNetTransport
Network transport using TIBCO Enterprise Message Service EMS client to connect to the network. This transport can be used by Java Applets and Java applications. TibrvJMSTransport does not require JNI library. It connects to the TIBCO Enterprise Message Service server directly. To receive notification in case the underlying EMS transport is terminated, useTibrv.setErrorCallback()
method.
-
-
Constructor Summary
Constructors Constructor Description TibrvJMSTransport()
Creates EMS transport connecting to the TIBCO Enterprise Message Service server running on the local computer with default port.TibrvJMSTransport(java.lang.String serverURL)
Creates EMS transport connecting to the TIBCO Enterprise Message Service server specified by serverURL parameter.TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password)
Creates EMS transport connecting as specified user to the TIBCO Enterprise Message Service server.TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password, java.util.Hashtable sslParameters)
Creates EMS transport connecting via TLS to the TIBCO Enterprise Message Service server.TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password, java.util.Hashtable sslParameters, boolean emulateReconnect)
Create EMS transport which has the ability to reconnect to a server among a list of comma separated EMS servers in the event of current connection is down.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys this transport and all associated listeners.void
destroyInbox(java.lang.String inbox)
Explicitly destroy an inbox when automatic inbox garbage collection is disabled.java.lang.String
getCurrentConnectedServer()
Get the url of currently connected server.java.lang.String
getDurableListenerMode()
Returns currently configured durable listener name prefix.boolean
isPersistentDelivery()
Returns true if persistent delivery mode is set for this transport.void
recoverConnection()
This method is used to reestablish a connection with an EMS server.void
setDurableListenerMode(java.lang.String durableNamePrefix)
Set or cancel durable listener mode.void
setInboxGarbageCollection(boolean val)
Enable or disable automatic inbox garbage collection.void
setPersistentDelivery(boolean persistent)
Set persistent delivery mode for this transport.java.lang.String
toString()
Returns string representation of this transportvoid
unsubscribe(java.lang.String durableNamePrefix, java.lang.String subject)
Unsubscribe durable Jakarta Messaging subscriber previously created for Rendezvous listener in durable listener mode.
-
-
-
Constructor Detail
-
TibrvJMSTransport
public TibrvJMSTransport() throws com.tibco.tibrv.TibrvException
Creates EMS transport connecting to the TIBCO Enterprise Message Service server running on the local computer with default port.- Throws:
com.tibco.tibrv.TibrvException
-
TibrvJMSTransport
public TibrvJMSTransport(java.lang.String serverURL) throws com.tibco.tibrv.TibrvException
Creates EMS transport connecting to the TIBCO Enterprise Message Service server specified by serverURL parameter.- Throws:
com.tibco.tibrv.TibrvException
-
TibrvJMSTransport
public TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password) throws com.tibco.tibrv.TibrvException
Creates EMS transport connecting as specified user to the TIBCO Enterprise Message Service server.- Throws:
com.tibco.tibrv.TibrvException
-
TibrvJMSTransport
public TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password, java.util.Hashtable sslParameters) throws com.tibco.tibrv.TibrvException
Creates EMS transport connecting via TLS to the TIBCO Enterprise Message Service server. TLS parameters which can be set in the sslParameters Hashtable are documented in com.tibco.tibjms.TibjmsSSL class.- Throws:
com.tibco.tibrv.TibrvException
-
TibrvJMSTransport
public TibrvJMSTransport(java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password, java.util.Hashtable sslParameters, boolean emulateReconnect) throws com.tibco.tibrv.TibrvException
Create EMS transport which has the ability to reconnect to a server among a list of comma separated EMS servers in the event of current connection is down. The server is picked in round robin fashion. The reconnect will start with last connected server.- Throws:
com.tibco.tibrv.TibrvException
-
-
Method Detail
-
destroy
public void destroy()
Destroys this transport and all associated listeners.- Specified by:
destroy
in classcom.tibco.tibrv.TibrvTransport
-
toString
public java.lang.String toString()
Returns string representation of this transport- Overrides:
toString
in classjava.lang.Object
-
setPersistentDelivery
public void setPersistentDelivery(boolean persistent)
Set persistent delivery mode for this transport.
-
isPersistentDelivery
public boolean isPersistentDelivery()
Returns true if persistent delivery mode is set for this transport.
-
setDurableListenerMode
public void setDurableListenerMode(java.lang.String durableNamePrefix) throws com.tibco.tibrv.TibrvException
Set or cancel durable listener mode. If parameterdurableNamePrefix
specifies non-empty string, all subsequent calls to create Rendezvous listeners on this transport will use durable Jakarta Messaging subscribers created on a Session with AUTO_ACKNOWLEDGE acknowledge mode and with namedurableNamePrefix:subject-name
. Such subscribers remain present even if corresponding Rendezvous listener is closed viaTibrvListener.destroy()
. If an application creates identical Rendesvous listener again, it will receive messages sent to it while it was offline. To completely destroy durable listener, it must be first destroyed via call toTibrvListener.destroy()
and then unsubscribed via call tounsubscribe()
method. If this method is called withnull
parameter it cancels durable listener mode such that subsequent calls to create Rendezvous listeners will not use durable Jakarta Messaging subscribers. This method can be also used to change durable subscriber name prefix at any time.- Parameters:
durableNamePrefix
- set durable listener mode if not empty, cancel durable subscriber mode if this parameter isnull
.- Throws:
java.lang.IllegalArgumentException
- if parameter is an empty string.com.tibco.tibrv.TibrvException
- if listener creation failed for any reason.
-
getDurableListenerMode
public java.lang.String getDurableListenerMode()
Returns currently configured durable listener name prefix. Returnsnull
if durable listener mode is not set.
-
recoverConnection
public void recoverConnection() throws com.tibco.tibrv.TibrvException
This method is used to reestablish a connection with an EMS server. The transport has to be created with emulate reconnect mode set to true if non-fault-tolarent behavior of a ',' separated server URL list is desired.- Throws:
com.tibco.tibrv.TibrvException
- if a new connection was not established.
-
getCurrentConnectedServer
public java.lang.String getCurrentConnectedServer()
Get the url of currently connected server.- Returns:
- server url
-
unsubscribe
public void unsubscribe(java.lang.String durableNamePrefix, java.lang.String subject) throws com.tibco.tibrv.TibrvException
Unsubscribe durable Jakarta Messaging subscriber previously created for Rendezvous listener in durable listener mode. Notice this method must be called only after corresponding Rendezvous listener has beed destroyed. If Rendezvous listener is not destroyed this method throws exception.- Parameters:
durableNamePrefix
- durable name prefix specified at the time Rendezvous listener was created.subject
- listener subject.- Throws:
com.tibco.tibrv.TibrvException
- if listener with such name prefix and subject was never created or if it is open (not destroyed).
-
setInboxGarbageCollection
public void setInboxGarbageCollection(boolean val) throws com.tibco.tibrv.TibrvException
Enable or disable automatic inbox garbage collection. By default, when the application creates an inbox, creates a listener on that inbox and finally destroys the listener on that inbox, the transport automatically garbage collects the inbox and its resources. If the application needs to create a listener on the same inbox more than once, this method can be used to disable automatic inbox garbage collection.- Parameters:
val
- equals false to disable inbox garbage collection.- Throws:
com.tibco.tibrv.TibrvException
- if any inboxes already exist when this method is called.
-
destroyInbox
public void destroyInbox(java.lang.String inbox) throws com.tibco.tibrv.TibrvException
Explicitly destroy an inbox when automatic inbox garbage collection is disabled.- Parameters:
inbox
- inbox to be destroyed.- Throws:
com.tibco.tibrv.TibrvException
- if automatic garbage collection is enabled or if the string is not an inbox.
-
-