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

com.github.fridujo.rabbitmq.mock.MockDefaultExchange Maven / Gradle / Ivy

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

import com.rabbitmq.client.AMQP;

import java.util.Map;

class MockDefaultExchange implements MockExchange {
    private final MockNode node;

    MockDefaultExchange(MockNode mockNode) {
        this.node = mockNode;
    }

    @Override
    public void publish(String previousExchangeName, String routingKey, AMQP.BasicProperties props, byte[] body) {
        node.getQueue(routingKey).ifPresent(q -> q.publish("default", routingKey, props, body));
    }

    @Override
    public void bind(ReceiverPointer receiver, String routingKey, Map arguments) {
        // nothing needed
    }

    @Override
    public void unbind(ReceiverPointer pointer, String routingKey) {
        // nothing needed
    }

    @Override
    public ReceiverPointer pointer() {
        throw new IllegalStateException("No ReceiverPointer (internal use) should be needed for the default exchange");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy