Skip to content

Commit

Permalink
fix issues #6 - only declare queue & exchange when channel is created
Browse files Browse the repository at this point in the history
  • Loading branch information
jlavallee committed May 4, 2013
1 parent 2136c13 commit 960a6cd
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/main/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ protected boolean initChannel() throws IOException {
log.fatalError("Failed to open channel: " + channel.getCloseReason().getLocalizedMessage());
}
setChannel(channel);
}

//TODO: Break out queue binding
if(getQueue() != null && !getQueue().isEmpty()) {
channel.queueDeclare(getQueue(), queueDurable(), queueExclusive(), queueAutoDelete(), getQueueArguments());

if(!StringUtils.isBlank(getExchange())) { //Use a named exchange
channel.exchangeDeclare(getExchange(), getExchangeType(), true);
channel.queueBind(getQueue(), getExchange(), getRoutingKey());
//TODO: Break out queue binding
if(getQueue() != null && !getQueue().isEmpty()) {
channel.queueDeclare(getQueue(), queueDurable(), queueExclusive(), queueAutoDelete(), getQueueArguments());

if(!StringUtils.isBlank(getExchange())) { //Use a named exchange
channel.exchangeDeclare(getExchange(), getExchangeType(), true);
channel.queueBind(getQueue(), getExchange(), getRoutingKey());
}
}
}

log.info("bound to:"
+"\n\t queue: " + getQueue()
+"\n\t exchange: " + getExchange()
+"\n\t routing key: " + getRoutingKey()
+"\n\t arguments: " + getQueueArguments()
);
log.info("bound to:"
+"\n\t queue: " + getQueue()
+"\n\t exchange: " + getExchange()
+"\n\t routing key: " + getRoutingKey()
+"\n\t arguments: " + getQueueArguments()
);
}

return true;
}
Expand Down

0 comments on commit 960a6cd

Please sign in to comment.