KMTopicRequestor Class Reference
Inherits from | KCObject : NSObject |
Declared in | KMTopicRequestor.h |
Overview
The TopicRequestor helper class simplifies making service requests.
KMTopicRequestor is a JMS 1.0 API. KMMessageConsumer or KMTopicSubscriber should be used instead.
The TopicRequestor constructor is given a non-transacted KMTopicSession and a destination KMTopic. It creates a KMTemporaryTopic for the responses and provides a request method that sends the request message and waits for its reply.
This is a basic request/reply abstraction that should be sufficient for most uses. JMS providers and clients are free to create more sophisticated versions.
Tasks
-
– initWithSession:topic:
Constructor for the TopicRequestor class.
-
– request:
Sends a request and waits for a reply. The temporary topic is used for the JMSReplyTo destination; the first reply is returned, and any following replies are discarded.
-
– close
Closes the TopicRequestor and its session.
Instance Methods
close
Closes the TopicRequestor and its session.
- (void)close
Discussion
Since a provider may allocate some resources on behalf of a TopicRequestor, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
Note that this method closes the KMTopicSession object passed to the TopicRequestor constructor.
Exceptions
- KMJMSException
if the JMS provider fails to close the TopicRequestor due to some internal error.
Declared In
KMTopicRequestor.h
initWithSession:topic:
Constructor for the TopicRequestor class.
- (KMTopicRequestor *)initWithSession:(KMTopicSession *)session topic:(KMTopic *)topic
Parameters
- session
the KMTopicSession the topic belongs to
- topic
the topic to perform the request/reply call on
Discussion
KMMessageConsumer or KMTopicSubscriber should be used instead.
This implementation assumes the session parameter to be non-transacted, with a delivery mode of either AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE.
Exceptions
- KMJMSException
if the JMS provider fails to create the TopicRequestor due to some internal error.
- KMInvalidDestinationException
if an invalid topic is specified.
Declared In
KMTopicRequestor.h
request:
Sends a request and waits for a reply. The temporary topic is used for the JMSReplyTo destination; the first reply is returned, and any following replies are discarded.
- (KMMessage *)request:(KMMessage *)message
Parameters
- message
the message to send
Return Value
the reply message
Exceptions
- KMJMSException
if the JMS provider fails to complete the request due to some internal error.
Declared In
KMTopicRequestor.h