Skip to content
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

SSCSSI-443: Remove feature toggle BYPASS_NOTIFICATIONS_SERVICE #4292

Merged
merged 9 commits into from
Jan 22, 2025
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 @@ -10,6 +10,5 @@ java:
HANDLE_CCD_CALLBACKMAP_V2: true
POST_HEARINGS_B_FEATURE: true
POST_HEARINGS_FEATURE: true
BYPASS_NOTIFICATIONS_SERVICE: true
INFECTED_BLOOD_COMPENSATION_ENABLED: true
SUBMIT_APPEAL_SERVICE_V2_ENABLED: true
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ java:
DELETED_REDACTED_DOC_ENABLED: true
CITIZEN_LOGIN_SERVICE_V2: true
ADD_LINK_TO_OTHER_ASSOCIATED_CASES_V2: true
BYPASS_NOTIFICATIONS_SERVICE: true
HANDLE_CCD_CALLBACKMAP_V2: true
TESTING_SUPPORT_ENABLED: true
SEND_LETTER_SERVICE_ENABLED: "true"
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 @@ -39,7 +39,6 @@ java:
DELETED_REDACTED_DOC_ENABLED: true
CITIZEN_LOGIN_SERVICE_V2: true
ADD_LINK_TO_OTHER_ASSOCIATED_CASES_V2: true
BYPASS_NOTIFICATIONS_SERVICE: true
BYPASS_HEARING_API_SERVICE: true
HANDLE_CCD_CALLBACKMAP_V2: true
TESTING_SUPPORT_ENABLED: true
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 @@ -283,8 +283,6 @@ feature:
enabled: ${SCOTTISH_PO_BOX_ENABLED:false}
urgent-hearing:
enabled: ${URGENT_HEARING_ENABLED:false}
bypass-notifications-service:
enabled: ${BYPASS_NOTIFICATIONS_SERVICE:false}
handle-ccd-callbackMap-v2:
enabled: ${HANDLE_CCD_CALLBACKMAP_V2:false}
submit-appeal-service-v2:
Expand Down Expand Up @@ -2033,14 +2031,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
Loading