public class SourceSerializerChain extends java.lang.Object implements SourceSerializer
SourceSerializer
implementation that chains together multiple source serializers. When a caller passes Message
to this serializer, it calls all the serializers in the chain, in the original order specified, until one can parse
and return CloudTrailSource
. If all source serializers in the chain are called, and they cannot successfully
parse the message, then this class throws an IOException
that indicates that no sources are available.
This class remembers the first source serializer in the chain that can successfully parse messages, and will continue to use that serializer when there are future messages.
Constructor and Description |
---|
SourceSerializerChain(java.util.List<? extends SourceSerializer> sourceSerializers)
Constructs a new
SourceSerializerChain with the specified source serializers. |
Modifier and Type | Method and Description |
---|---|
CloudTrailSource |
getSource(Message sqsMessage)
Get CloudTrail log file information by parsing single SQS message.
|
public SourceSerializerChain(java.util.List<? extends SourceSerializer> sourceSerializers)
SourceSerializerChain
with the specified source serializers.
Use SourceSerializerFactory.createSourceSerializerChain()
for default construction.
When source are required from this serializer, it will call each of these source serializers in the same order
specified here until one of them return CloudTrailSource
.
sourceSerializers
- A list of at least one SourceSerializer
implementation instance.public CloudTrailSource getSource(Message sqsMessage) throws java.io.IOException
getSource
in interface SourceSerializer
sqsMessage
- The message polled from SQS queue.CloudTrailSource
that contains log file information.java.io.IOException
- If sqsMessage
is unrecognized.