Interface RMQDeserializationSchema<T>
-
- Type Parameters:
T- The output type of theRMQSource
- All Superinterfaces:
org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>,Serializable
@PublicEvolving public interface RMQDeserializationSchema<T> extends Serializable, org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
Interface for the set of methods required to parse an RMQ delivery.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRMQDeserializationSchema.RMQCollector<T>Special collector for RMQ messages.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddeserialize(com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body, RMQDeserializationSchema.RMQCollector<T> collector)This method takes all the RabbitMQ delivery information supplied by the client extract the data and pass it to the collector.booleanisEndOfStream(T nextElement)Method to decide whether the element signals the end of the stream.default voidopen(org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext context)Initialization method for the schema.
-
-
-
Method Detail
-
open
default void open(org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext context) throws ExceptionInitialization method for the schema. It is called before the actual working methodsdeserialize(com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[], org.apache.flink.streaming.connectors.rabbitmq.RMQDeserializationSchema.RMQCollector<T>)and thus suitable for one time setup work.The provided
DeserializationSchema.InitializationContextcan be used to access additional features such as e.g. registering user metrics.- Parameters:
context- Contextual information that can be used during initialization.- Throws:
Exception
-
deserialize
void deserialize(com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body, RMQDeserializationSchema.RMQCollector<T> collector) throws IOExceptionThis method takes all the RabbitMQ delivery information supplied by the client extract the data and pass it to the collector.NOTICE: The implementation of this method can call
RMQDeserializationSchema.RMQCollector.setMessageIdentifiers(java.lang.String, long)with a custom correlation ID and delivery tag if checkpointing anduseCorrelationIDwere enabled in the constructor ofRMQSource.- Parameters:
envelope- an AMQPEnvelope.properties- theAMQP.BasicPropertiesof the message.body- the message itself as a byte array.collector- theRMQDeserializationSchema.RMQCollectorthat will collect the data.- Throws:
IOException- When the body of the message can't be parsed
-
isEndOfStream
boolean isEndOfStream(T nextElement)
Method to decide whether the element signals the end of the stream. If true is returned the element won't be emitted.- Parameters:
nextElement- The element to test for the end-of-stream signal.- Returns:
- True, if the element signals end of stream, false otherwise.
-
-