-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support passwordless connections for JMS ServiceBus in Spring #33489
Conversation
API change check APIView has identified API level changes in this PR and created following API reviews. spring-cloud-azure-autoconfigure |
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
The resource scopes in ServiceBus is the same for different Clouds: "https://servicebus.azure.net/.default". |
* | ||
* @since 4.7.0 | ||
*/ | ||
public class AzureServiceBusCredentialSupplier implements Supplier<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class AzureServiceBusCredentialSupplier implements Supplier<String> { | |
public class AzureServiceBusJmsCredentialSupplier implements Supplier<String> { |
?
String remoteUrl = String.format(AMQP_URI_FORMAT, host, properties.getIdleTimeout().toMillis()); | ||
String username = serviceBusConnectionString.getSharedAccessKeyName(); | ||
String password = serviceBusConnectionString.getSharedAccessKey(); | ||
String remoteUrl = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ServiceBusJmsConnectionFactory
shouldn't need to understand the serviceBusPasswordlessProperties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored the code, I provided a ServiceConnectionStringProvider, but it's a little strange for me now. Maybe we can discuss about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServiceConnectionStringProvider
is not the best choice.
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) | ||
@ActiveProfiles("servicebus-jms-passwordless") | ||
public class ServiceBusJmsPasswordlessIT { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceBusJmsPasswordlessIT.class); | ||
private static final String DATA = "service bus jms passwordless test"; | ||
private static final String QUEUE_NAME = "que001"; | ||
private final Exchanger<String> EXCHANGER = new Exchanger<>(); | ||
|
||
@Autowired | ||
private JmsTemplate jmsTemplate; | ||
|
||
@Test | ||
@Timeout(70) | ||
public void testServiceBusJmsOperation() throws InterruptedException { | ||
LOGGER.info("ServiceBusJmsPasswordlessIT begin."); | ||
jmsTemplate.convertAndSend(QUEUE_NAME, DATA); | ||
LOGGER.info("Send message: {}", DATA); | ||
String msg = EXCHANGER.exchange(null); | ||
Assertions.assertEquals(DATA, msg); | ||
LOGGER.info("ServiceBusJmsPasswordlessIT end."); | ||
} | ||
|
||
@JmsListener(destination = QUEUE_NAME, containerFactory = "jmsListenerContainerFactory") | ||
public void receiveQueueMessage(String message) throws InterruptedException { | ||
LOGGER.info("Received message from queue: {}", message); | ||
EXCHANGER.exchange(message); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of the public
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
34366bd
to
61ee897
Compare
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
No pipelines are associated with this pull request. |
1 similar comment
No pipelines are associated with this pull request. |
/azp run java - spring - tests-weekly |
Azure Pipelines successfully started running 1 pipeline(s). |
pipeline: java - spring - tests ✅ |
...azure/spring/cloud/autoconfigure/passwordless/AzurePasswordlessEnvironmentPostProcessor.java
Outdated
Show resolved
Hide resolved
...oconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/passwordless/package-info.java
Outdated
Show resolved
Hide resolved
…33489) Support passwordless connections for JMS ServiceBus in Spring.
Description
Linked issue: #32463
The PR is an implementation to support passwordless connections for JMS ServiceBus in Spring.
Test locally
IT
pipeline: java - spring - tests ✅
pipeline: java - spring - tests-weekly ✅