Package | com.pushtechnology.diffusion |
Class | public class ServiceTopicHandler |
Inheritance | ServiceTopicHandler ![]() |
Since : | 4.1 |
A Service Topic is one that provides request/response capability (see ServiceTopicData). When a Client subscribes to a Service Topic then a Topic Load Message will be received by the Client that indicates that it is a Message#isServiceLoad() Service Load Message. In response to such a Message the Client application should create a handler of this type using the Client connection DiffusionClientImpl#createServiceTopicHandler(Message, ServiceTopicListener) method and declaring a ServiceTopicListener to receive all responses and notifications from the Topic.
The handler simplifies the use of such a Topic and avoids having to format messages to send to the Topic or parse messages received from it.
When such a handler is in use then messages received on the Topic will not be delivered to the DiffusionConnectionListener Listener declared to the DiffusionClientImpl client connection object.
Method | Defined By | ||
---|---|---|---|
ServiceTopicHandler(diffusionClient:DiffusionClient, message:TopicMessage, listener:ServiceTopicListener) | ServiceTopicHandler | ||
Returns the client connection. | ServiceTopicHandler | ||
Returns a message containing any fixed data returned by the service on
subscription. | ServiceTopicHandler | ||
getServiceType():String
Returns the service type. | ServiceTopicHandler | ||
getTopic():String
Returns the topic name. | ServiceTopicHandler | ||
request(requestType:String, data:TopicMessage, requestId:String = null):String
Sends a request to the Service. | ServiceTopicHandler |
ServiceTopicHandler | () | Constructor |
public function ServiceTopicHandler(diffusionClient:DiffusionClient, message:TopicMessage, listener:ServiceTopicListener)
diffusionClient:DiffusionClient | |
message:TopicMessage | |
listener:ServiceTopicListener |
getConnection | () | method |
public function getConnection():DiffusionClient
Returns the client connection.
ReturnsDiffusionClient — the client connection.
|
getServiceData | () | method |
public function getServiceData():TopicMessage
Returns a message containing any fixed data returned by the service on subscription.
The message may contain headers and/or data as set in the ServiceTopicData or may be empty if no data was set.
ReturnsTopicMessage — service data message
|
getServiceType | () | method |
public function getServiceType():String
Returns the service type.
This is the service type as returned by the ServiceTopicData.
ReturnsString — service type.
|
getTopic | () | method |
public function getTopic():String
Returns the topic name.
ReturnsString — the topic name.
|
request | () | method |
public function request(requestType:String, data:TopicMessage, requestId:String = null):String
Sends a request to the Service.
If the request succeeds then a response will be returned on ServiceTopicListener#serviceResponse(ServiceTopicResponse) and if it fails or is timed out at the server then an error will be returned on ServiceTopicListener#serviceError(ServiceTopicError).
Parameters
requestType:String — the request type. This must be one of the allowed
types for the service.
| |
data:TopicMessage — optional request data. If supplied then the headers and
data from the given Message will be sent with the request.
| |
requestId:String (default = null ) — a unique request identifier. This must be unique. If the
identifier passed is not unique then the results will be unpredictable.
This value will default to null. If the value is null then the identifier
will be generated.
|
String — unique request identifier
|
com.pushtechnology.diffusion.errors:UnsupportedServerMethodError
— UnsupportedServerMethodError if sendTopicMessage would throw the same
|