MigratoryData Client API for Python
Developer's Guide and Reference Manual
|
This class implements all the necessary operations for connecting to a cluster of MigratoryData servers and publishing real-time messages. More...
Public Member Functions | |
MigratoryDataClient () | |
Create a MigratoryDataClient object. | |
void | setEntitlementToken (String token) |
Assign an authorization token to the client. More... | |
void | setServers (List< String > servers) |
Connect to a MigratoryData server in the list provided by the argument. More... | |
String | publish (MigratoryDataMessage message) |
Publish the message provided in argument. More... | |
Static Public Attributes | |
static final String | NOTIFY_PUBLISH_OK = "NOTIFY_PUBLISH_OK" |
Indicate that the client successfully published a message. More... | |
static final String | NOTIFY_PUBLISH_FAILED = "NOTIFY_PUBLISH_FAILED" |
Indicate that the client was unable to publish a message. More... | |
static final String | NOTIFY_PUBLISH_DENIED = "NOTIFY_PUBLISH_DENIED" |
Indicate that the client was unable to publish a message because it is not allowed by your entitlement rules. More... | |
static final String | NOTIFY_PUBLISH_NO_SUBSCRIBER = "NOTIFY_PUBLISH_NO_SUBSCRIBER" |
Indicate that the client was unable to publish a message because there is no client subscribed to the subject of the message. More... | |
static final String | NOTIFY_PUBLISH_TIMEOUT = "NOTIFY_PUBLISH_TIMEOUT" |
Indicate that the client timed out when trying to get a response for a message publication. More... | |
This class implements all the necessary operations for connecting to a cluster of MigratoryData servers and publishing real-time messages.
void MigratoryDataClient.setEntitlementToken | ( | String | token | ) |
Assign an authorization token to the client.
To define which users of your application have access to which subjects, you will first have to configure the parameter Entitlement
in the configuration file of the MigratoryData server — see the parameter Entitlement
in the MigratoryData Configuration Guide (PDF, HTML).
Then, you will have to use the entitlement-related part of the MigratoryData Extension API to allow or deny certain users to subscribe / publish to certain subjects or use the Basic entitlement mode which do not require any programming.
Basic
entitlement method in your MigratoryData servers using the parameter Entitlement
, then, in order to be able to publish messages, the token defined by this API method must be equal to the value of the parameter EntitlementAllowToken
of your servers.token | A string representing an authorization token. |
void MigratoryDataClient.setServers | ( | List< String > | servers | ) |
Connect to a MigratoryData server in the list provided by the argument.
servers | The addresses of the MigratoryData servers in the cluster. |
MigratoryDataException | Exceptions with the following error codes:
|
String MigratoryDataClient.publish | ( | MigratoryDataMessage | message | ) |
Publish the message provided in argument.
message | A MigratoryDataMessage object |
MigratoryDataException | Exceptions with the following error codes:
|
|
static |
Indicate that the client successfully published a message.
This constant is used to indicate that the publication of a message has succeeded.
|
static |
Indicate that the client was unable to publish a message.
This constant is used to indicate that the publication of a message has failed.
|
static |
Indicate that the client was unable to publish a message because it is not allowed by your entitlement rules.
This constant is used to indicate that the publication of a message has failed. The publication failed because the client – identified with the token defined with the API method MigratoryDataClient.setEntitlementToken() – is not allowed to publish on the subject of the message.
|
static |
Indicate that the client was unable to publish a message because there is no client subscribed to the subject of the message.
This constant is used to indicate that the publication of the message has failed. The publication failed because there is no client then subscribed to the subject of the message.
|
static |
Indicate that the client timed out when trying to get a response for a message publication.
This constant is used to indicate that the publication of the message timeout without knowing if the message was published or not.