Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
Notification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Notification
Commits
3ce2451d
Commit
3ce2451d
authored
3 years ago
by
Sathyanarayanan Saravanamuthu
Browse files
Options
Downloads
Patches
Plain Diff
Resolving review comments
parent
284b2428
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!232
Update os-core-lib-azure
,
!231
initial commit
,
!181
Adding entries to requests table on notification processing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java
+17
-10
17 additions, 10 deletions
...cation/provider/azure/messageBus/ProcessNotification.java
with
17 additions
and
10 deletions
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java
+
17
−
10
View file @
3ce2451d
...
...
@@ -32,6 +32,8 @@ import org.slf4j.MDC;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.stereotype.Component
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.Date
;
@Component
@ConditionalOnExpression
(
"${azure.serviceBus.enabled:true} || ${azure.eventGridToServiceBus.enabled:true}"
)
...
...
@@ -50,7 +52,7 @@ public class ProcessNotification {
public
void
performNotification
(
IMessage
message
,
String
subscriptionName
)
throws
Exception
{
TelemetryClient
telemetryClient
=
new
TelemetryClient
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
stopWatch
.
start
();
try
{
NotificationContent
notificationContent
=
requestBodyAdapter
.
extractNotificationContent
(
message
,
subscriptionName
);
...
...
@@ -58,13 +60,9 @@ public class ProcessNotification {
String
dataPartitionId
=
notificationContent
.
getExtractAttributes
().
get
(
DpsHeaders
.
DATA_PARTITION_ID
);
String
correlationId
=
notificationContent
.
getExtractAttributes
().
get
(
DpsHeaders
.
CORRELATION_ID
);
MDC
.
setContextMap
(
mdcContextMap
.
getContextMap
(
correlationId
,
dataPartitionId
));
dpsHeaders
.
setThreadContext
(
dataPartitionId
,
correlationId
);
LOGGER
.
info
(
"Notification process started for message with id: {}"
,
message
.
getMessageId
());
HttpResponse
response
=
notificationHandler
.
notifySubscriber
(
notificationContent
.
getNotificationId
(),
notificationContent
.
getData
(),
notificationContent
.
getExtractAttributes
());
ConcurrentMap
properties
=
telemetryClient
.
getContext
().
getProperties
();
properties
.
put
(
"correlation-id"
,
correlationId
);
properties
.
put
(
"data-partition-id"
,
dataPartitionId
);
RequestTelemetry
requestTelemetry
=
new
RequestTelemetry
(
"SBQueueRequest"
,
...
...
@@ -72,8 +70,16 @@ public class ProcessNotification {
stopWatch
.
getTime
(),
"500"
,
false
);
requestTelemetry
.
setId
(
message
.
getMessageId
());
MDC
.
setContextMap
(
mdcContextMap
.
getContextMap
(
correlationId
,
dataPartitionId
));
dpsHeaders
.
setThreadContext
(
dataPartitionId
,
correlationId
);
LOGGER
.
info
(
"Notification process started for message with id: {}"
,
message
.
getMessageId
());
HttpResponse
response
=
notificationHandler
.
notifySubscriber
(
notificationContent
.
getNotificationId
(),
notificationContent
.
getData
(),
notificationContent
.
getExtractAttributes
());
if
(!
response
.
isSuccessCode
())
{
telemetryClient
.
trackRequest
(
requestTelemetry
);
throw
new
Exception
(
NOT_ACKNOWLEDGE
);
...
...
@@ -83,11 +89,12 @@ public class ProcessNotification {
telemetryClient
.
trackRequest
(
requestTelemetry
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
String
.
format
(
"An error occurred performing Notification for message with ID: "
,
message
.
getMessageId
()),
e
);
LOGGER
.
error
(
String
.
format
(
"An error occurred performing Notification for message with ID: "
,
message
.
getMessageId
()),
e
);
throw
e
;
}
finally
{
ThreadScopeContextHolder
.
getContext
().
clear
();
MDC
.
clear
();
stopWatch
.
stop
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment