When you publish a message to a Simple Message Queue (SMQ, formerly MNS) topic, SMQ can deliver it directly to an HTTP endpoint. This removes the need to poll for new messages -- your server receives them automatically as they are published.
This guide covers how to create a topic and subscription, publish a message, and verify message delivery end to end.
How it works
You publish a message to a topic.
SMQ matches the message against each subscription's filtering tag, if configured.
For each matching HTTP subscription, SMQ pushes the message to the endpoint URL.
Your server processes the request and acknowledges receipt.
If delivery fails, SMQ retries based on the subscription's retry policy.
Before you begin
Before you create the subscription, make sure your HTTP server is ready to receive messages:
Validate message signatures. Verify the signature on incoming requests to confirm they originate from SMQ. This prevents unauthorized parties from sending fake messages to your endpoint. For implementation details, see Verify a signature on an HTTP server.
Create a topic
Log on to the SMQ console.
In the left-side navigation pane, choose Topic Model > Topics.
In the top navigation bar, select a region.
On the Topics page, click Create Topic.
In the Create Topic panel, configure the following parameters, and then click OK. After the topic is created, the Topic Details page appears.
Parameter Description Name The name of the topic. Maximum Message Length The maximum length of the message body sent to the topic. Enable Logging Feature Whether to enable the log management feature.
Create an HTTP subscription
In the left-side navigation pane, choose Topic Model > Subscriptions.
On the Subscriptions page, click Create Subscription.
In the Create Subscription panel, configure the following parameters, and then click OK.
Parameter Required Description Topic Name Yes The topic to subscribe to. Subscription Name Yes A name for this subscription. Subscription Yes Select HTTP as the push method. Endpoint Yes The full HTTP URL where messages are delivered. Intranet IPs are not supported. Message Filtering Tag No A tag to filter which messages are pushed. Only messages published with a matching tag are delivered. Retry Policy Yes The retry policy that controls how failed deliveries are retried. Message Format Yes The format of the pushed message body. See Message formats for details.
Message formats
The Message Format parameter controls the structure of the message body that your server receives.
| Format | Description |
|---|---|
| SIMPLIFIED | The message body contains only the raw message content with no attribute information. Use this format when your server only needs the message payload. |
| JSON | The message body is a JSON object that includes the message content and message attributes. |
| XML | The message body is an XML document that includes the message content and message attributes. |
Publish a test message
In the left-side navigation pane, choose Topic Model > Topics.
On the Topics page, find your topic and click Publish Message in the Actions column.
On the Try Publishing Message to {topic} Topic page, configure the following parameters, and then click Publish Message.
Parameter Required Description Message Content Yes The message body to publish. Message Tag No A tag for message filtering. Only subscriptions with a matching filtering tag receive this message. Subscription Type Yes Select HTTP. Check your HTTP server logs to verify the message was received.
What's next
Verify a signature on an HTTP server -- Validate HTTP message signatures using the client SDKs.