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
.
The Command
interface is designed to be equivalent to the named commands, and includes error checking and support from the Client
and HAClient
infrastructure. The Message
/send
interface intentionally bypasses most of this infrastructure.
For example, when you use an HAClient
to subscribe to a topic using the Command
interface or the named convenience method, the HAClient
registers the subscription in the MemorySubscriptionManager
so the subscription can automatically be resumed on failover. In contrast, if you simply send a Message
to AMPS, the HAClient
does not track the subscription, and the subscription will not be resumed on failover.
The 60East engineers recommend using the Command
interface. If your application has the need to bypass most of the Client
infrastructure for some reason, the Message
/send
interface provides the flexibility to do so (at the expense of managing any part of that you need in your application). For most uses, however, the Command
infrastructure provides the same capabilities to customize the command to AMPS, with full support from the client infrastructure.
Last updated