AtData ActiveMQ Integration
AtData hosts an Apache ActiveMQ server which enables clients to connect and receive real-time data.
Connection Methods
Below are examples and guidelines for integrating with AtData's ActiveMQ using Java and Python consumers.
Java
You will need to use the OpenWire protocol to connect using a Java consumer. The Java consumer combines the destination ID
and namespace
into a single command-line parameter called destination
. This parameter should be assembled as follows:
<destination_id> + ".RTO." + <namespace>
Example:
destination1.RTO.yourcompany
For more information on destination ID
refer to the section below.
Python
The STOMP protocol is required to connect using a Python consumer. Ensure that you have installed the stomp.py
package, as it is necessary for this integration.
Note
A similarly named package,
stompy
, is not compatible and should not be used.
Required Parameters for Connection
Both the Java and Python consumer programs require the following parameters:
- username: A 4- or 5-digit numeric code provided by AtData.
- password: A 32-digit hexadecimal string.
- namespace: An alphanumeric string, typically your company name, provided as part of your credentials.
- destination ID: A user-defined string.
- connection ID: A user-defined string.
Credentials
AtData will provide the
username
,password
, andnamespace
as part of your credentials.
Destination ID and Connection ID
The destination ID
and connection ID
parameters allow you to configure load-balancing or mirroring behavior in your integration.
-
Consistency: These IDs should remain consistent across process restarts. Changing these values (e.g., using a timestamp) can lead to data loss or performance issues.
-
Multiple Consumers from Same IP: Each process must have a unique
connection ID
. -
Mirroring Behavior: Launching multiple consumers with unique
destination IDs
will cause each process to receive the same set of data. -
Load Balancing Behavior: Launching multiple consumers with the same
destination ID
but uniqueconnection IDs
will distribute the incoming data across the consumers.
Handling Incoming Data
Your consumer program will receive messages in JSON format. Each message represents an event, such as open
or pixel
, depending on the specific TowerData service you are using. The typical message format is as follows:
{
"md5": "098f6bcd4621d373cade4e832627b4f6"
}
In some services, additional fields may be included in the message. For example:
{
"md5": "098f6bcd4621d373cade4e832627b4f6",
"label": "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"
}
Updated 2 months ago