public class SnsMessageManager extends Object
Constructor and Description |
---|
SnsMessageManager()
Creates an
SnsMessageManager using the AWS region obtained from the environment. |
SnsMessageManager(String region)
Creates an
SnsMessageManager pinned to the given region. |
Modifier and Type | Method and Description |
---|---|
void |
handleMessage(InputStream messageBody,
SnsMessageHandler handler)
Unmarshalls a message and delivers it to the given handler.
|
SnsMessage |
parseMessage(InputStream messageBody)
Unmarshalls a message into a subclass of
SnsMessage . |
public SnsMessageManager()
SnsMessageManager
using the AWS region obtained from the environment. See
Region Selection
for more information.public SnsMessageManager(String region)
SnsMessageManager
pinned to the given region. This handler will throw an exception if it
recieves a message from another region. If you must handle messages from multiple regions then you should
maintain a cache of region to SnsMessageManager
instances.region
- Region to pin handler to.public SnsMessage parseMessage(InputStream messageBody)
SnsMessage
. This will automatically validate the authenticity of the
mesage to ensure it was sent by SNS. If the validity of the message cannot be verified an exception will be thrown.messageBody
- Input stream containing message JSON.public void handleMessage(InputStream messageBody, SnsMessageHandler handler)
messageBody
- Input stream containing message JSON.handler
- Handler to process message.Copyright © 2019. All rights reserved.