IN - public class RMQSink<IN>
extends org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>
| 限定符和类型 | 字段和说明 |
|---|---|
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 |
| 构造器和说明 |
|---|
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) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 org.apache.flink.api.common.functions.RichFunctionopen 在类中 org.apache.flink.api.common.functions.AbstractRichFunctionExceptionpublic void invoke(IN value)
value - The incoming datapublic void close()
close 在接口中 org.apache.flink.api.common.functions.RichFunctionclose 在类中 org.apache.flink.api.common.functions.AbstractRichFunctionCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.