Skip to content

Commit daa5c91

Browse files
artembilanspring-builds
authored andcommitted
Expose MessageProducerSpec.role(String) option
Related to: https://stackoverflow.com/questions/78294542/role-in-integrationflow-dsl (cherry picked from commit fd81adf)
1 parent 38e0b90 commit daa5c91

File tree

2 files changed

+16
-1
lines changed
  • spring-integration-core/src/main/java/org/springframework/integration/dsl
  • spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl

2 files changed

+16
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageProducerSpec.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,6 +70,20 @@ public S autoStartup(boolean autoStartup) {
7070
return _this();
7171
}
7272

73+
/**
74+
* Specify the role for the endpoint.
75+
* Such endpoints can be started/stopped as a group.
76+
* @param role the role for this endpoint.
77+
* @return the endpoint spec
78+
* @see org.springframework.context.SmartLifecycle
79+
* @see org.springframework.integration.support.SmartLifecycleRoleController
80+
* @since 6.1.8
81+
*/
82+
public S role(String role) {
83+
this.target.setRole(role);
84+
return _this();
85+
}
86+
7387
/**
7488
* Specify the {@code outputChannel} for the
7589
* {@link org.springframework.integration.core.MessageProducer}.

spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
511511
public IntegrationFlow jmsMessageDrivenRedeliveryFlow() {
512512
return IntegrationFlow
513513
.from(Jms.messageDrivenChannelAdapter(amqFactory)
514+
.role("someRole")
514515
.errorChannel("errorChannelForRedelivery")
515516
.destination("jmsMessageDrivenRedelivery")
516517
.configureListenerContainer(c -> c

0 commit comments

Comments
 (0)