Skip to content

Commit

Permalink
SSCSSI-443: Remove feature toggle BYPASS_NOTIFICATIONS_SERVICE (#4292)
Browse files Browse the repository at this point in the history
* SSCSSI-443: Remove feature toggle BYPASS_NOTIFICATIONS_SERVICE

* Update values.preview.template.yaml

* Update application.yaml

---------

Co-authored-by: sanjayparekh-hmcts <36845702+sanjayparekh-hmcts@users.noreply.github.com>
  • Loading branch information
SomeshRA and sanjayparekh-hmcts authored Jan 22, 2025
1 parent 9d4a304 commit 3901b05
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion charts/sscs-tribunals-api/values.aat.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ java:
TESTING_SUPPORT_ENABLED: true
POST_HEARINGS_B_FEATURE: true
POST_HEARINGS_FEATURE: true
BYPASS_NOTIFICATIONS_SERVICE: true
INFECTED_BLOOD_COMPENSATION_ENABLED: true
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ java:
ELASTIC_SEARCH_FEATURE: true
ELINKS_V2_FEATURE_ENABLED: true
DELETED_REDACTED_DOC_ENABLED: true
BYPASS_NOTIFICATIONS_SERVICE: true
TESTING_SUPPORT_ENABLED: true
SEND_LETTER_SERVICE_ENABLED: "true"
SEND_LETTER_SERVICE_BASEURL: "http://rpe-send-letter-service-aat.service.core-compute-aat.internal"
Expand Down
1 change: 0 additions & 1 deletion charts/sscs-tribunals-api/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ java:
ELASTIC_SEARCH_FEATURE: true
ELINKS_V2_FEATURE_ENABLED: true
DELETED_REDACTED_DOC_ENABLED: true
BYPASS_NOTIFICATIONS_SERVICE: true
TESTING_SUPPORT_ENABLED: true
EXUI_API_URL: "https://${SERVICE_NAME}-xui"
TOPIC_NAME: "${SERVICE_NAME}-servicebus-main-topic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ public class TopicConsumer {
private final CallbackDispatcher<SscsCaseData> dispatcher;
private final SscsCaseCallbackDeserializer sscsDeserializer;
private final NotificationsMessageProcessor notificationsMessageProcessor;
private final boolean isNotificationServiceBypassed;

public TopicConsumer(@Value("${callback.maxRetryAttempts}") Integer maxRetryAttempts,
CallbackDispatcher<SscsCaseData> dispatcher,
SscsCaseCallbackDeserializer sscsDeserializer, NotificationsMessageProcessor notificationsMessageProcessor,
@Value("${feature.bypass-notifications-service.enabled:false}") boolean isNotificationServiceBypassed) {
SscsCaseCallbackDeserializer sscsDeserializer, NotificationsMessageProcessor notificationsMessageProcessor) {
this.maxRetryAttempts = maxRetryAttempts;
//noinspection unchecked
this.dispatcher = dispatcher;
this.sscsDeserializer = sscsDeserializer;
this.notificationsMessageProcessor = notificationsMessageProcessor;
this.isNotificationServiceBypassed = isNotificationServiceBypassed;
}


Expand All @@ -52,12 +49,7 @@ public TopicConsumer(@Value("${callback.maxRetryAttempts}") Integer maxRetryAtte
public void onMessage(String message, @Header(JmsHeaders.MESSAGE_ID) String messageId) {
log.info("Message Id {} received from the service bus", messageId);
processEvidenceShareMessageWithRetry(message, 1, messageId);

log.info("Determining if notification service should be bypassed {} ", isNotificationServiceBypassed ? "Yes" : "No");
if (isNotificationServiceBypassed) {
log.info("Bypassing notification service for message id {}", messageId);
notificationsMessageProcessor.processMessage(message, messageId);
}
notificationsMessageProcessor.processMessage(message, messageId);
}

private void processEvidenceShareMessageWithRetry(String message, int retry, String messageId) {
Expand Down
4 changes: 0 additions & 4 deletions src/main/resources/config/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ feature:
enabled: ${SCOTTISH_PO_BOX_ENABLED:false}
urgent-hearing:
enabled: ${URGENT_HEARING_ENABLED:false}
bypass-notifications-service:
enabled: ${BYPASS_NOTIFICATIONS_SERVICE:false}
hearings-case-updateV2:
enabled: ${HEARINGS_CASE_UPDATE_V2_ENABLED:false}

Expand Down Expand Up @@ -2019,14 +2017,12 @@ spring:
accept-case-insensitive-enums: true
accept-case-insensitive-properties: true
job.scheduler:
autoStart: ${BYPASS_NOTIFICATIONS_SERVICE:false}
retryPolicy:
maxNumberOfJobExecutions: 2
delayBetweenAttemptsInMs: 1000
quartzProperties:
org.quartz:
scheduler:
autoStartup: ${BYPASS_NOTIFICATIONS_SERVICE:false}
instanceId: AUTO
idleWaitTime: ${JOB_SCHEDULER_POLL_INTERVAL:10000}
dataSource:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class TopicConsumerTest {

@Before
public void setup() {
topicConsumer = new TopicConsumer(RETRY_THREE_TIMES, dispatcher, deserializer, notificationsMessageProcessor, false);
topicConsumer = new TopicConsumer(RETRY_THREE_TIMES, dispatcher, deserializer, notificationsMessageProcessor);
}

@Test
Expand Down Expand Up @@ -134,7 +134,7 @@ public void handleValidRequest() {

@Test
public void shouldProcessMessageForNotifications() {
topicConsumer = new TopicConsumer(RETRY_THREE_TIMES, dispatcher, deserializer, notificationsMessageProcessor, true);
topicConsumer = new TopicConsumer(RETRY_THREE_TIMES, dispatcher, deserializer, notificationsMessageProcessor);
topicConsumer.onMessage(MESSAGE, "1");
verify(notificationsMessageProcessor).processMessage(MESSAGE, "1");
}
Expand Down

0 comments on commit 3901b05

Please sign in to comment.