XD-3519: Rabbit Taps

- instead of publishing to the default exchange, producers now publish to a topic exchange, to which the main queue is bound
- taps on a stream simply bind a queue to the same exchange with a name including the group for the tapping stream and a
    routing key pattern `#`
 - this means that multiple instances of the same tap stream will compete but multiple tap streams will get a copy
- for partitioned data, a single topic exchange is used, which each partition queue bound with its name as the routing key
 - this means taps on partitioned data see the consolidated messages

Remove unused binder utilities.

Use TopicExchange Always

Use a TopicExchange when binding a pubSub producer for consistency.

Remove Deprecated Binder Method

Add group to BindingProperties

- also fix artifact name in test support pom
- also fix some kafka tests (does not imply that kafka taps work - yet)
This commit is contained in:
Gary Russell
2015-11-02 18:05:04 -05:00
committed by Mark Fisher
parent 80b1d28be1
commit a375e61260
31 changed files with 549 additions and 410 deletions

View File

@@ -24,7 +24,6 @@ import java.util.concurrent.LinkedBlockingDeque;
import org.springframework.cloud.stream.binder.Binder;
import org.springframework.cloud.stream.test.matcher.MessageQueueMatcher;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
@@ -39,6 +38,7 @@ import org.springframework.util.Assert;
* </ul>
*
* @author Eric Bottard
* @author Gary Russell
* @see MessageQueueMatcher
*/
public class TestSupportBinder implements Binder<MessageChannel> {
@@ -51,7 +51,7 @@ public class TestSupportBinder implements Binder<MessageChannel> {
}
@Override
public void bindPubSubConsumer(String name, MessageChannel inboundBindTarget, Properties properties) {
public void bindPubSubConsumer(String name, MessageChannel inboundBindTarget, String group, Properties properties) {
}
@@ -86,6 +86,11 @@ public class TestSupportBinder implements Binder<MessageChannel> {
}
@Override
public void unbindPubSubConsumers(String name, String group) {
}
@Override
public void unbindProducers(String name) {
@@ -116,11 +121,6 @@ public class TestSupportBinder implements Binder<MessageChannel> {
return null;
}
@Override
public boolean isCapable(Capability capability) {
return false;
}
public MessageCollector messageCollector() {
return messageCollector;
}
@@ -132,7 +132,7 @@ public class TestSupportBinder implements Binder<MessageChannel> {
*/
private static class MessageCollectorImpl implements MessageCollector{
private Map<MessageChannel, BlockingQueue<Message<?>>> results = new HashMap<>();
private final Map<MessageChannel, BlockingQueue<Message<?>>> results = new HashMap<>();
private BlockingQueue register(MessageChannel channel) {
LinkedBlockingDeque<Message<?>> result = new LinkedBlockingDeque<>();
@@ -145,6 +145,7 @@ public class TestSupportBinder implements Binder<MessageChannel> {
Assert.notNull(results.remove(channel), "Trying to unregister a mapping for an unknown channel [" + channel + "]");
}
@Override
public BlockingQueue<Message<?>> forChannel(MessageChannel channel) {
BlockingQueue<Message<?>> queue = results.get(channel);
Assert.notNull(queue, "Channel [" + channel + "] was not bound by " + TestSupportBinder.class);