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

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

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

import static com.github.fridujo.rabbitmq.mock.exchange.MockExchangeCreator.creatorWithExchangeType;

import com.github.fridujo.rabbitmq.mock.exchange.ConsistentHashExchange;
import com.github.fridujo.rabbitmq.mock.exchange.TypedMockExchangeCreator;
import com.rabbitmq.client.ConnectionFactory;

public abstract class ConfigurableConnectionFactory extends ConnectionFactory {

    protected final MockNode mockNode = new MockNode();

    @SuppressWarnings("unchecked")
    public T withAdditionalExchange(TypedMockExchangeCreator mockExchangeCreator) {
        mockNode.getConfiguration().registerAdditionalExchangeCreator(mockExchangeCreator);
        return (T) this;
    }

    /**
     * Make available the {@value ConsistentHashExchange#TYPE}'' exchange.
     * 

* See https://github.com/rabbitmq/rabbitmq-consistent-hash-exchange. * @return this {@link ConfigurableConnectionFactory} instance (for chaining) */ public T enableConsistentHashPlugin() { return withAdditionalExchange( creatorWithExchangeType(ConsistentHashExchange.TYPE, ConsistentHashExchange::new) ); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy