Skip to content

Commit a25b0a8

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 6c4f7c0 commit a25b0a8

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
@@ -522,6 +522,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
522522
public IntegrationFlow jmsMessageDrivenRedeliveryFlow() {
523523
return IntegrationFlow
524524
.from(Jms.messageDrivenChannelAdapter(amqFactory)
525+
.role("someRole")
525526
.errorChannel("errorChannelForRedelivery")
526527
.destination("jmsMessageDrivenRedelivery")
527528
.configureListenerContainer(c -> c

0 commit comments

Comments
 (0)