All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fridujo.rabbitmq.mock.exchange.MultipleReceiverExchange Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.github.fridujo.rabbitmq.mock.exchange;

import java.util.Map;
import java.util.stream.Stream;

import com.github.fridujo.rabbitmq.mock.AmqArguments;
import com.github.fridujo.rabbitmq.mock.ReceiverPointer;
import com.github.fridujo.rabbitmq.mock.ReceiverRegistry;
import com.rabbitmq.client.AMQP;

public abstract class MultipleReceiverExchange extends BindableMockExchange {

    protected MultipleReceiverExchange(String name, String type, AmqArguments arguments, ReceiverRegistry receiverRegistry) {
        super(name, type, arguments, receiverRegistry);
    }

    protected Stream matchingReceivers(String routingKey, AMQP.BasicProperties props) {
        return bindConfigurations
            .stream()
            .filter(bindConfiguration -> match(bindConfiguration, routingKey, props.getHeaders()))
            .map(BindableMockExchange.BindConfiguration::receiverPointer);
    }

    protected abstract boolean match(BindableMockExchange.BindConfiguration bindConfiguration, String routingKey, Map headers);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy