Application Development with AMPS Clients
📄️ Unique Client Naming and AMPS
In the AMPS client APIs, each instance of the AMPS client is required to provide a client name. The AMPS server treats the client name as a distinct token for a specific instance of an application.
📄️ Which version of the client do I need for a specific version of AMPS?
If you have a choice, use the latest released version of the client library, available from the 60East website (www.crankuptheamps.com).
📄️ How does an application pass credentials to AMPS?
AMPS and the AMPS clients provide a flexible authentication infrastructure that's designed to get out of your way as much as possible and let you reuse the components you already have. Regardless of how simple or sophisticated your enterprise authentication system is, the AMPS clients make it easy to use that system with AMPS.
📄️ What are the entries in a bookmark store file?
The AMPS clients each use a similar format for the fully-logged bookmark store.
📄️ Is there a way to store client state in AMPS?
Yes, the AMPS SOW provides a convenient way to store persistent client state while minimizing external dependencies.
📄️ Should I Use TCP_NODELAY for connections to AMPS?
If your application needs the lowest-possible latency, it can help to set TCP_NODELAY. The overall effect of this setting is consume more bandwidth to achieve lower latency for an individual message.
📄️ Should I use Command or Message to send commands to AMPS?
You should (almost) always use a Command and execute or executeAsync rather than a Message.
📄️ How do I set the CorrelationId when I publish a message?
To set the CorrelationId on a message, use the Command interface to create the appropriate publish command and then use the executeAsync method on the client to send the command to AMPS.
📄️ Can I send commands to AMPS from inside a message handler?
Yes, you can do this, but not from the same Client that is receiving the messages. Instead, you should create another Client object to send commands to AMPS. You should also keep in mind that, while the receive thread is in your message handler, no other messages are being processed for the client that called the message handler.
📄️ How do I use a custom Authenticator with HAClient?
More details on passing credentials to AMPS are available in the FAQ entry How does an application pass credentials to AMPS?.
📄️ What's the difference between CommandId, QueryId, and SubId?
A simple way to look at the differences is that clients submit a CommandId with their commands. AMPS then uses that CommandId when it needs to refer to the command later on.
📄️ Do I need to use an HAClient?
The HAClient, provided in the AMPS client libraries, provides the following additional capabilities as compared to the Client:
📄️ What character set is supported for CorrelationID?
Correlation ID must contain only base64 characters. Characters outside of this set will result in a message header parse format error. Properly encoding Correlation ID will ensure successful parsing of this field.
📄️ Can I add a correlation token to the header of a message?
Yes. As of 4.0, AMPS adds a CorrelationId header which is set by the publisher and transmitted to subscribers.
📄️ How do I change the filter on a subscription?
To do this, you need the subscription ID of the subscription you need to replace. The client sends that subscription ID and the new filter, and asks AMPS to replace the subscription.
📄️ Can a client have more than one subscription at a time?
A single client can have more than one subscription active at the same time. AMPS delivers messages for all active subscriptions to the client.
📄️ Can a subscriber tell who published a message?
AMPS includes the user ID of the user who published the message in message headers when:
📄️ Why do messages sometimes have strange data when I'm using asynchronous processing?
For performance, the AMPS clients reuse the message object that's passed into asynchronous message handlers rather than creating a new object each time the message handler is called.
📄️ What character encoding is being used by the AMPS clients?
AMPS clients only enforce encoding for header fields. They do not enforce any particular encoding in the message data.
📄️ Why does my HAClient appear to hang when my server is down or URI is incorrect?
In most cases, the client isn't actually hung, but the ServerChooser is continuing to try to connect to the list of URIs without success. The client appears to be hung because none of the servers are responding.
📄️ How can I reconnect to my AMPS server when a disconnect occurs?
The HAClient class makes it easy to automatically reconnect to an AMPS instance, or failover to alternate instance, after a disconnect occurs. HAClient allows you to build resilient and robust messaging applications.
📄️ How can I use AMPS with a XAML application?
Check out full instructions on how to do this, including sample code, at Using AMPS in XAML Applications on our blog.
📄️ Can I enforce unique client naming without creating a transaction log file?
AMPS enforces unique client naming whenever there's a journal (transaction log) configured, and allows duplicate clients when there's no journal configured.
📄️ How can I tell if my program is not entitled to publish to a topic?
Most AMPS applications are designed for maximum throughput, which includes carefully testing entitlements for publishers and subscribers before deployment and minimizing the amount of work that clients do when publishing a message. However, this also means that it's rare for publishes to fail, and a failure in publication usually represents a critical error.
📄️ When using the Python client, will the background thread exit when the program exits?
Yes.
📄️ Do I need more than one AMPS client object in my program?
AMPS Client objects are capable of concurrent publishes and subscribes to multiple topics on an AMPS instance. These objects are designed to handle multiple subscriptions and publication to multiple topics. However, each Client object can only connect to one AMPS instance at a time.
📄️ Why does AMPS disconnect a client with a 'name in use' error?
When a transaction log is configured, AMPS needs to be able to tell the difference between connections to be able to reliably persist and replay the message stream. AMPS uses the client name as a unique application identifier to be able to tell when a connection is a connection from a different client as compared to a new connection from the same client.
📄️ In bookmark subscribes, why does EPOCH give me the same messages as MOST_RECENT?
The AMPS HA clients have built in duplicate detection: when you're using a bookmark store, the clients don't deliver messages that the application has already processed.