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

lv.ctco.cukes.rabbitmq.sample.configuration.InMemoryAMQPBroker Maven / Gradle / Ivy

There is a newer version: 1.0.10
Show newest version
package lv.ctco.cukes.rabbitmq.sample.configuration;

import org.apache.qpid.server.Broker;
import org.apache.qpid.server.BrokerOptions;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component("amqpBroker")
public class InMemoryAMQPBroker {

    private final Broker broker = new Broker();

    BrokerOptions brokerOptions() {
        BrokerOptions brokerOptions = new BrokerOptions();

        brokerOptions.setConfigProperty("qpid.amqp_port", "5672");
        brokerOptions.setInitialConfigurationLocation(getClass().getResource("/initial-config.json").getFile());
        brokerOptions.setStartupLoggedToSystemOut(false);
        return brokerOptions;
    }

    @PostConstruct
    public void start() throws Exception {
        broker.startup(brokerOptions());
    }

    @PreDestroy
    public void stop() {
        broker.shutdown();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy