Example usage for org.springframework.amqp.rabbit.connection LocalizedQueueConnectionFactory getTargetConnectionFactory

List of usage examples for org.springframework.amqp.rabbit.connection LocalizedQueueConnectionFactory getTargetConnectionFactory

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.connection LocalizedQueueConnectionFactory getTargetConnectionFactory.

Prototype

@Override
    public ConnectionFactory getTargetConnectionFactory(Object key) 

Source Link

Usage

From source file:org.springframework.amqp.rabbit.connection.LocalizedQueueConnectionFactoryTests.java

@Test
public void test2Queues() throws Exception {
    try {/*from   ww w .  ja v a  2  s.  co  m*/
        String rabbit1 = "localhost:1235";
        String rabbit2 = "localhost:1236";
        String[] addresses = new String[] { rabbit1, rabbit2 };
        String[] adminUris = new String[] { "http://localhost:11235", "http://localhost:11236" };
        String[] nodes = new String[] { "rabbit@foo", "rabbit@bar" };
        String vhost = "/";
        String username = "guest";
        String password = "guest";
        LocalizedQueueConnectionFactory lqcf = new LocalizedQueueConnectionFactory(
                mockCF("localhost:1234", null), addresses, adminUris, nodes, vhost, username, password, false,
                null);
        lqcf.getTargetConnectionFactory("[foo, bar]");
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage(), containsString(
                "Cannot use LocalizedQueueConnectionFactory with more than one queue: [foo, bar]"));
    }
}