Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-4025] Add possiblity for the RMQ Streaming Source to customize the queue #2073

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class RMQSource<OUT> extends MultipleIdsMessageAcknowledgingSourceBase<OU
private final Integer port;
private final String username;
private final String password;
private final String queueName;
protected final String queueName;
private final boolean usesCorrelationId;
protected DeserializationSchema<OUT> schema;

Expand Down Expand Up @@ -177,6 +177,15 @@ protected ConnectionFactory setupConnectionFactory() {
return new ConnectionFactory();
}

/**
* Sets up the queue. The default implementation just declares the queue. The user may override
* this method to have a custom setup for the queue (i.e. binding the queue to an exchange or
* defining custom queue parameters)
*/
protected void setupQueue() throws IOException {
channel.queueDeclare(queueName, true, false, false, null);
}

/**
* Initializes the connection to RMQ.
*/
Expand All @@ -195,7 +204,7 @@ private void initializeConnection() {
try {
connection = factory.newConnection();
channel = connection.createChannel();
channel.queueDeclare(queueName, true, false, false, null);
setupQueue();
consumer = new QueueingConsumer(channel);

RuntimeContext runtimeContext = getRuntimeContext();
Expand Down