Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sidebar_position: 4

@Bean
public ConnectionFactoryCustomizer connectionFactoryCustomizer() {
return (ConnectionFactoryCustomizer) (asyncProps, connectionFactory) -> {
return (connectionFactory, asyncProps) -> {
connectionFactory.setExceptionHandler(new MyCustomExceptionHandler()); // Optional custom exception handler
connectionFactory.setCredentialsProvider(new MyCustomCredentialsProvider()); // Optional custom credentials provider
return connectionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ or automatic recovery strategies:

@Bean
public ConnectionFactoryCustomizer connectionFactoryCustomizer() {
return (ConnectionFactoryCustomizer) (asyncProps, connectionFactory) -> {
return (connectionFactory, asyncProps) -> {
connectionFactory.setExceptionHandler(new MyCustomExceptionHandler()); // Optional custom exception handler
connectionFactory.setCredentialsProvider(new MyCustomCredentialsProvider()); // Optional custom credentials provider
return connectionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
@FunctionalInterface
public interface ConnectionFactoryCustomizer {

ConnectionFactory customize(AsyncProps asyncProps, ConnectionFactory connectionFactory);
ConnectionFactory customize(ConnectionFactory connectionFactory, AsyncProps asyncProps);

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static ConnectionFactoryProvider connectionFactoryProvider(AsyncProps asy
map.from(rabbitProperties::determineVirtualHost).whenNonNull().to(newFactory::setVirtualHost);
newFactory.useNio();
setUpSSL(newFactory, rabbitProperties);
return cfCustomizer.customize(props, newFactory);
return cfCustomizer.customize(newFactory, props);
} catch (Exception e) {
throw new RuntimeException("Error creating ConnectionFactory: ", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ UnroutableMessageProcessor defaultUnroutableMessageProcessor(UnroutableMessageNo
@Bean
@ConditionalOnMissingBean(ConnectionFactoryCustomizer.class)
public ConnectionFactoryCustomizer defaultConnectionFactoryCustomizer() {
return ((asyncProps, connectionFactory) -> connectionFactory);
return (connectionFactory, asyncProps) -> connectionFactory;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ void shouldReturnCreateDiscardProvider() {

@Test
void shouldReturnBrokerProvider() {
when(cfCustomizer.customize(any(AsyncProps.class), any(ConnectionFactory.class)))
.thenAnswer(invocation -> invocation.<ConnectionFactory>getArgument(1));
when(cfCustomizer.customize(any(ConnectionFactory.class), any(AsyncProps.class)))
.thenAnswer(invocation -> invocation.<ConnectionFactory>getArgument(0));

// Arrange
AsyncProps props = new AsyncProps();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class RabbitMQDiscardProviderImplTest {

@BeforeEach
void setUp() {
when(cfCustomizer.customize(any(AsyncProps.class), any(ConnectionFactory.class)))
.thenAnswer(invocation -> invocation.<ConnectionFactory>getArgument(1));
when(cfCustomizer.customize(any(ConnectionFactory.class), any(AsyncProps.class)))
.thenAnswer(invocation -> invocation.<ConnectionFactory>getArgument(0));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void shouldReturnSameConnectionFactoryWhenCustomizing() {
ConnectionFactory originalFactory = new ConnectionFactory();
AsyncProps asyncProps = new AsyncProps();

ConnectionFactory result = customizer.customize(asyncProps, originalFactory);
ConnectionFactory result = customizer.customize(originalFactory, asyncProps);

assertThat(result).isSameAs(originalFactory);
}
Expand Down