|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.MQIsdp.ClientMQIsdp
The ClientMQIsdp Java class provides an API for the WebSphere MQ Integrator MQIsdp protocol.
Constructor Summary | |
ClientMQIsdp(java.lang.String server,
int port)
The ClientMQIsdp constructor. |
Method Summary | |
int |
connect(java.lang.String clientid,
boolean cleanstart,
short keepalive)
Connect to the WebSphere MQ Integrator broker. |
int |
connect(java.lang.String clientid,
boolean cleanstart,
short keepalive,
java.lang.String willtopic,
int willQoS,
java.lang.String willmsg,
boolean willretain)
Connect to the WebSphere MQ Integrator broker. |
void |
connectionLost()
Default callback method invoked when the MQIsdp client TCP/IP connection is unexpectedly terminated. |
void |
disconnect()
Disconnect from the WebSphere MQ Integrator broker. |
int |
getBlockingTimeout()
Method to query the number seconds the MQIsdp client waits for waits for a blocking API methods to complete. |
int |
getPortNumber()
Method to query the IP port number to which the MQIsdp client is connected. |
int |
getRetry()
Method to return the interval at which message delivery will be retried in the event of acknowledgements not being received. |
java.lang.String |
getServerAddress()
Method to query the IP address or hostname to which the MQIsdp client is connected. |
boolean |
isConnected()
Method to the indicate the connection state of the MQIsdp client. |
void |
notifyAck(int ref,
int msgid)
This method is required as part of the MQIsdp protocol implementation, but should not be called by users of this class. |
boolean |
outstanding(int aMsgId)
|
void |
ping()
Send a MQIsdp ping message to indicate that the MQIsdp client is alive. |
int |
publish(java.lang.String thisTopic,
byte[] thisMessage,
int thisQoS,
boolean retained)
Publish a message on a particular topic to the WebSphere MQ Integrator broker. |
void |
publishArrived(java.lang.String topic,
byte[] message,
int QoS,
boolean retained)
Default callback method invoked when a publication arrives for this MQIsdp client. |
void |
published(int aMsgId)
Default callback method invoked when a message is successfully published from the MQIsdp client. |
void |
registerAdvancedHandler(com.ibm.MQIsdp.MQIsdpAdvancedCallback aHandler)
Register an advanced callback handler as described by the MQIsdpAdvancedCallback interface |
void |
registerSimpleHandler(com.ibm.MQIsdp.MQIsdpSimpleCallback aHandler)
Register an simple callback handler as described by the MQIsdpSimpleCallback interface |
void |
setBlockingTimeout(int timeout)
Set the time limit which the MQIsdp client should wait for a blocking API method to complete. |
void |
setRetry(int retryNum)
Set the retry interval at which the MQIsdp client should retry any messages that have not been acknowledged by the broker. |
void |
startTrace()
Start tracing the MQIsdp Java client. |
void |
stopTrace()
Stop tracing the MQIsdp Java client. |
byte[] |
subscribe(java.lang.String[] theseTopics,
int[] theReqQoS)
Subscribe to one or more topics. |
void |
terminate()
This method terminates all running threads in the ClientMQIsdp instance. |
int |
unsubscribe(java.lang.String[] theseTopics)
Unsubscribe from one or more topics. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClientMQIsdp(java.lang.String server, int port) throws java.lang.Exception
server
- The IP address or hostname of the WebSphere MQ Integrator broker.port
- The IP port number of the SCADAInput node on the WebSphere MQ Integrator broker.Method Detail |
public void startTrace() throws java.lang.Exception
java.lang.Exception
public void stopTrace()
public void registerAdvancedHandler(com.ibm.MQIsdp.MQIsdpAdvancedCallback aHandler)
aHandler
- Object that will handle the advanced (and simple) callback events.public void registerSimpleHandler(com.ibm.MQIsdp.MQIsdpSimpleCallback aHandler)
aHandler
- Object that will handle the simple callback events.public int connect(java.lang.String clientid, boolean cleanstart, short keepalive) throws java.lang.Exception
clientid
- A character identfier which must be unique across all MQIsdp connections to the
WebSphere MQ Integrator broker.cleanstart
- A boolean indicating if the broker should cleanup if the TCP/IP connection unexpectedly terminates.
This will leave the broker in a state as though the client had never connected.
keepalive
- An interval in seconds that the broker should use to determine if the MQIsdp client is still alive.
If data is not received within this interval the broker will assume the client has terminated and disconnect it, cleaning
up if the clean start flag was specified. If the connection is inactive for keepalive seconds this client library will
automatically ping the connection to keep it alive until an explicit disconnect is issued.
java.lang.Exception
public int connect(java.lang.String clientid, boolean cleanstart, short keepalive, java.lang.String willtopic, int willQoS, java.lang.String willmsg, boolean willretain) throws java.lang.Exception
clientid
- As abovecleanstart
- As above.keepalive
- As above.willtopic
- In the event of the MQIsdp connection unexpectedly terminating the broker will publish a 'Last Will and Testament' message on this topic.willQoS
- Publish the last will and testament message at this Quality of Service (0,1 or 2).willmsg
- In the event of the MQIsdp connection unexpectedly terminating the broker will publish this data on the above topic.willretain
- A boolean indicating if the 'Last Will and Testament' message should be a retained publication.
java.lang.Exception
public void connectionLost() throws java.lang.Exception
connectionLost
in interface MQIsdpSimpleCallback
java.lang.Exception
public void disconnect() throws java.lang.Exception
java.lang.Exception
public int getBlockingTimeout()
public java.lang.String getServerAddress()
public int getPortNumber()
public int getRetry()
public boolean isConnected()
public void notifyAck(int ref, int msgid)
notifyAck
in interface com.ibm.MQIsdp.MQIpdpClientCallback
public boolean outstanding(int aMsgId)
aMsgId
- A caller may query the delivery status of a message by supplying the message identifier returned from the publish method.
public void ping() throws java.lang.Exception
java.lang.Exception
public int publish(java.lang.String thisTopic, byte[] thisMessage, int thisQoS, boolean retained) throws java.lang.Exception
thisTopic
- A string containing the topic on which the associated data should be published.thisMessage
- A byte array containing the data to be published on the above topic.thisQoS
- The Quality of Service which the message should be delivered at.
retained
- - Should this be a retained publication?
java.lang.Exception
public void publishArrived(java.lang.String topic, byte[] message, int QoS, boolean retained)
NOTE:
Any implementation of this method should NOT call any of the
other API methods as this will cause a deadlock. Blocking for a significant
amount of time is also not advised. If API calls or blocking are required in this method, then
the method should start up a new thread to do the work.
publishArrived
in interface MQIsdpSimpleCallback
topic
- The topic associated with the received publication.message
- A byte array containing the publication data received.QoS
- The quality of service at which the message was delivered.retained
- Is this a retained publication?public void published(int aMsgId)
published
in interface MQIsdpAdvancedCallback
aMsgId
- The message identifier of the message successfully puyblished from this MQIsdp client.public void setBlockingTimeout(int timeout)
timeout
- The timeout interval in seconds. Default 30 seconds.public void setRetry(int retryNum)
The minimum retry interval that can be set is 10 seconds. If an attempt is made to set a value less than 10 seconds, then the API will assume a retry interval of 10 seconds.
retryNum
- The retry interval in seconds. Default 10 seconds.public void terminate()
public byte[] subscribe(java.lang.String[] theseTopics, int[] theReqQoS) throws java.lang.Exception
theseTopics
- An array of topics. Each topic is a character string.
java.lang.Exception
public int unsubscribe(java.lang.String[] theseTopics) throws java.lang.Exception
theseTopics
- An array of topics. Each topic is a character string.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |