Skip to content

Commit

Permalink
conditional support jms via spring.jms.servicebus.enabled config (#50)
Browse files Browse the repository at this point in the history
…enabled` config

## Purpose

Add conditional support jms via `spring.jms.servicebus.enabled` config,
in order to meet the one-click solution and step by step scenario.

## Does this introduce a breaking change?
<!-- Mark one with an "x". -->
```
[ ] Yes
[ ] No
```

## Pull Request Type
What kind of change does this Pull Request introduce?

<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
```

## How to Test
*  Get the code

```
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
```

* Test the code
<!-- Add steps to run the tests suite and/or manually test -->
```
```

## What to Check
Verify that the following are valid
* ...

## Other Information
<!-- Add any other helpful information that may be needed here. -->

Co-authored-by: Hao Zhang <[email protected]>
  • Loading branch information
haoozhang and Hao Zhang authored Sep 23, 2024
1 parent 7b16473 commit 8cae078
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spring:
visits-requests: visits-requests
visits-confirmations: visits-confirmations
servicebus:
enabled: false # disable messaging support by default
namespace: ${SERVICEBUS_NAMESPACE}
pricing-tier: premium
passwordless-enabled: true
Expand Down
3 changes: 2 additions & 1 deletion docs/09_lab_messaging/0901.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The connection to the Service Bus needs to be stored in the `spring.jms.serviceb
visits-requests: visits-requests
visits-confirmations: visits-confirmations
servicebus:
enabled: true
namespace: ${SERVICEBUS_NAMESPACE}
pricing-tier: premium
passwordless-enabled: true
Expand Down Expand Up @@ -84,7 +85,7 @@ The connection to the Service Bus needs to be stored in the `spring.jms.serviceb

1. In the config repository you will need to add the service bus connection information. Replace the contents of the current `application.yml` file with the contents of the [0901_application.yml file](0901_application.yml). The service bus namespace and identity client id will be injected via environment variables. This file includes the following change:

- An additional `spring.jms` section from lines `16` to `26`.
- An additional `spring.jms` section after the `spring.sql` section.

1. Commit and push your changes to the remote repository.

Expand Down
1 change: 1 addition & 0 deletions docs/09_lab_messaging/0901_application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spring:
visits-requests: visits-requests
visits-confirmations: visits-confirmations
servicebus:
enabled: true
namespace: ${SERVICEBUS_NAMESPACE}
pricing-tier: premium
passwordless-enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Date;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.samples.petclinic.visits.entities.VisitRequest;
Expand All @@ -14,6 +15,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@ConditionalOnProperty(name = "spring.jms.servicebus.enabled", havingValue = "true")
@Component
@Slf4j
@RequiredArgsConstructor
Expand Down

0 comments on commit 8cae078

Please sign in to comment.