Skip to content
This repository has been archived by the owner on Aug 19, 2018. It is now read-only.

Commit

Permalink
Neither name or channel are really required. Added channel delegation…
Browse files Browse the repository at this point in the history
… to binding.
  • Loading branch information
Joern Barthel committed Jul 25, 2009
1 parent 32af0ce commit 3890d1b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public Channel getChannel() {
return channel;
}

@Required
public void setChannel(Channel channel) {
this.channel = channel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public String getName() {
return name;
}

@Required
public void setName(String name) {
this.name = name;
}
Expand Down
24 changes: 24 additions & 0 deletions src/org/springframework/amqp/component/Binding.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Collections;
import java.io.IOException;

import com.rabbitmq.client.Channel;

public class Binding extends AbstractComponent {

private static final Log log = LogFactory.getLog(Binding.class);
Expand All @@ -17,6 +19,28 @@ public class Binding extends AbstractComponent {
private Queue queue;
private String key = NO_KEY;

@Override
public Channel getChannel() {

Channel channel = super.getChannel();

if (channel != null)
return channel;

channel = getExchange().getChannel();

if (channel != null)
return channel;

channel = getQueue().getChannel();

if (channel != null)
return channel;

throw new AMQException(String.format("No channel available for binding '%s'", this));

}

public Exchange getExchange() {
return exchange;
}
Expand Down

0 comments on commit 3890d1b

Please sign in to comment.