IN - public class RMQSink<IN>
extends org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>
| Modifier and Type | Field and Description |
|---|---|
protected com.rabbitmq.client.Channel |
channel |
protected com.rabbitmq.client.Connection |
connection |
protected String |
queueName |
protected org.apache.flink.api.common.serialization.SerializationSchema<IN> |
schema |
| Constructor and Description |
|---|
RMQSink(RMQConnectionConfig rmqConnectionConfig,
org.apache.flink.api.common.serialization.SerializationSchema<IN> schema,
RMQSinkPublishOptions<IN> publishOptions) |
RMQSink(RMQConnectionConfig rmqConnectionConfig,
org.apache.flink.api.common.serialization.SerializationSchema<IN> schema,
RMQSinkPublishOptions<IN> publishOptions,
SerializableReturnListener returnListener) |
RMQSink(RMQConnectionConfig rmqConnectionConfig,
String queueName,
org.apache.flink.api.common.serialization.SerializationSchema<IN> schema) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
invoke(IN value)
Called when new data arrives to the sink, and forwards it to RMQ.
|
void |
open(org.apache.flink.configuration.Configuration config) |
void |
setLogFailuresOnly(boolean logFailuresOnly)
Defines whether the producer should fail on errors, or only log them.
|
protected com.rabbitmq.client.Connection |
setupConnection()
Initializes the connection to RMQ using the default connection factory from
setupConnectionFactory(). |
protected com.rabbitmq.client.ConnectionFactory |
setupConnectionFactory()
Initializes the connection to RMQ with a default connection factory.
|
protected void |
setupQueue()
Sets up the queue.
|
getIterationRuntimeContext, getRuntimeContext, setRuntimeContextprotected transient com.rabbitmq.client.Connection connection
protected transient com.rabbitmq.client.Channel channel
protected org.apache.flink.api.common.serialization.SerializationSchema<IN> schema
@PublicEvolving public RMQSink(RMQConnectionConfig rmqConnectionConfig, String queueName, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema)
rmqConnectionConfig - The RabbitMQ connection configuration RMQConnectionConfig.queueName - The queue to publish messages to.schema - A SerializationSchema for turning the Java objects received into bytes@PublicEvolving public RMQSink(RMQConnectionConfig rmqConnectionConfig, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, RMQSinkPublishOptions<IN> publishOptions)
rmqConnectionConfig - The RabbitMQ connection configuration RMQConnectionConfig.schema - A SerializationSchema for turning the Java objects received into bytespublishOptions - A RMQSinkPublishOptions for providing message's routing key
and/or properties In this case the computeMandatoy or computeImmediate MUST return false
otherwise an IllegalStateException is raised during runtime.@PublicEvolving public RMQSink(RMQConnectionConfig rmqConnectionConfig, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, RMQSinkPublishOptions<IN> publishOptions, SerializableReturnListener returnListener)
rmqConnectionConfig - The RabbitMQ connection configuration RMQConnectionConfig.schema - A SerializationSchema for turning the Java objects received into bytespublishOptions - A RMQSinkPublishOptions for providing message's routing key
and/or propertiesreturnListener - A SerializableReturnListener implementation object to handle returned
message eventprotected void setupQueue()
throws IOException
IOExceptionpublic void setLogFailuresOnly(boolean logFailuresOnly)
logFailuresOnly - The flag to indicate logging-only on exceptions.protected com.rabbitmq.client.ConnectionFactory setupConnectionFactory()
throws Exception
ConnectionFactory.Exceptionprotected com.rabbitmq.client.Connection setupConnection()
throws Exception
setupConnectionFactory(). The user may override this method to setup and configure their
own Connection.Exceptionpublic void open(org.apache.flink.configuration.Configuration config)
throws Exception
open in interface org.apache.flink.api.common.functions.RichFunctionopen in class org.apache.flink.api.common.functions.AbstractRichFunctionExceptionpublic void invoke(IN value)
value - The incoming datapublic void close()
close in interface org.apache.flink.api.common.functions.RichFunctionclose in class org.apache.flink.api.common.functions.AbstractRichFunctionCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.