Example usage for org.springframework.amqp.rabbit.connection AbstractConnectionFactory setConnectionThreadFactory

List of usage examples for org.springframework.amqp.rabbit.connection AbstractConnectionFactory setConnectionThreadFactory

Introduction

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

Prototype

public void setConnectionThreadFactory(ThreadFactory threadFactory) 

Source Link

Document

Set the ThreadFactory on the underlying rabbit connection factory.

Usage

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

@Test
public void testCreatesConnectionWithGivenFactory() throws Exception {
    com.rabbitmq.client.ConnectionFactory mockConnectionFactory = mock(
            com.rabbitmq.client.ConnectionFactory.class);
    doCallRealMethod().when(mockConnectionFactory).params(any(ExecutorService.class));
    doCallRealMethod().when(mockConnectionFactory).setThreadFactory(any(ThreadFactory.class));
    doCallRealMethod().when(mockConnectionFactory).getThreadFactory();

    AbstractConnectionFactory connectionFactory = createConnectionFactory(mockConnectionFactory);
    ThreadFactory connectionThreadFactory = new CustomizableThreadFactory("connection-thread-");
    connectionFactory.setConnectionThreadFactory(connectionThreadFactory);

    assertEquals(connectionThreadFactory, mockConnectionFactory.getThreadFactory());
}