@@ -76,26 +76,28 @@ private CompletionStage<HttpResponse> getMU() {
76
76
}
77
77
78
78
private Route onNotificationResolution (
79
- final ActorSystem <Void > actorSystem ,
80
- final ActorRef <BackEnd .Event > backEnd ) {
79
+ final ActorSystem <Void > actorSystem ,
80
+ final ActorRef <BackEnd .Event > backEnd ) {
81
81
return entity (Jackson .unmarshaller (NotificationResolutionProcessorData .class ),
82
- obj -> onComplete (BackEnd .askOnNotificationResolution (actorSystem , backEnd , obj ), response -> {
83
- if (response .isSuccess () && Boolean .TRUE .equals (response .get ().updated ())) {
84
- return complete (StatusCodes .OK );
85
- } else {
86
- return complete (StatusCodes .IM_A_TEAPOT );
87
- }
88
- }));
82
+ obj -> onComplete (BackEnd .askOnNotificationResolution (actorSystem , backEnd , obj ), response -> {
83
+ if (response .isSuccess () && Boolean .TRUE .equals (response .get ().updated ())) {
84
+ return complete (StatusCodes .OK );
85
+ } else {
86
+ LOGGER .warn ("IM_A_TEAPOT" );
87
+ return complete (GlobalConstants .IM_A_TEA_POT );
88
+ }
89
+ }));
89
90
}
90
91
91
92
private Route routeDashboardData (
92
- final ActorSystem <Void > actorSystem ,
93
- final ActorRef <BackEnd .Event > backEnd ) {
93
+ final ActorSystem <Void > actorSystem ,
94
+ final ActorRef <BackEnd .Event > backEnd ) {
94
95
return onComplete (BackEnd .askGetDashboardData (actorSystem , backEnd ), response -> {
95
96
if (response .isSuccess ()) {
96
97
return complete (StatusCodes .OK , response .get (), Jackson .marshaller ());
97
98
} else {
98
- return complete (StatusCodes .IM_A_TEAPOT );
99
+ LOGGER .warn ("IM_A_TEAPOT" );
100
+ return complete (GlobalConstants .IM_A_TEA_POT );
99
101
}
100
102
});
101
103
}
@@ -105,12 +107,18 @@ private Route routeLinkInteraction() {
105
107
try {
106
108
LOGGER .debug ("{}" , obj );
107
109
return onComplete (postLinkInteraction (obj ),
108
- response -> response .isSuccess ()
109
- ? complete (response .get ())
110
- : complete (StatusCodes .IM_A_TEAPOT ));
110
+ response -> {
111
+ if (!response .isSuccess ()) {
112
+ LOGGER .warn ("IM_A_TEAPOT" );
113
+ }
114
+ return response .isSuccess ()
115
+ ? complete (response .get ())
116
+ : complete (GlobalConstants .IM_A_TEA_POT );
117
+ });
111
118
} catch (JsonProcessingException e ) {
119
+ LOGGER .warn ("IM_A_TEAPOT" );
112
120
LOGGER .error (e .getLocalizedMessage (), e );
113
- return complete (StatusCodes . IM_A_TEAPOT );
121
+ return complete (GlobalConstants . IM_A_TEA_POT );
114
122
}
115
123
});
116
124
}
@@ -119,21 +127,32 @@ private Route routeLinkInteractionToGid() {
119
127
return entity (Jackson .unmarshaller (ApiModels .LinkInteractionToGidSyncBody .class ), obj -> {
120
128
try {
121
129
return onComplete (postLinkInteractionToGid (obj ),
122
- response -> response .isSuccess ()
123
- ? complete (response .get ())
124
- : complete (ApiModels .getHttpErrorResponse (StatusCodes .IM_A_TEAPOT )));
130
+ response -> {
131
+ if (!response .isSuccess ()) {
132
+ LOGGER .warn ("IM_A_TEAPOT" );
133
+ }
134
+ return response .isSuccess ()
135
+ ? complete (response .get ())
136
+ : complete (ApiModels .getHttpErrorResponse (GlobalConstants .IM_A_TEA_POT ));
137
+ });
125
138
} catch (JsonProcessingException e ) {
126
139
LOGGER .error (e .getLocalizedMessage (), e );
127
140
}
128
- return complete (ApiModels .getHttpErrorResponse (StatusCodes .IM_A_TEAPOT ));
141
+ LOGGER .warn ("IM_A_TEAPOT" );
142
+ return complete (ApiModels .getHttpErrorResponse (GlobalConstants .IM_A_TEA_POT ));
129
143
});
130
144
}
131
145
132
146
private Route routeMU () {
133
147
return onComplete (getMU (),
134
- response -> response .isSuccess ()
135
- ? complete (response .get ())
136
- : complete (StatusCodes .IM_A_TEAPOT ));
148
+ response -> {
149
+ if (!response .isSuccess ()) {
150
+ LOGGER .warn ("IM_A_TEAPOT" );
151
+ }
152
+ return response .isSuccess ()
153
+ ? complete (response .get ())
154
+ : complete (GlobalConstants .IM_A_TEA_POT );
155
+ });
137
156
}
138
157
139
158
private Route createRoute (
@@ -144,11 +163,11 @@ private Route createRoute(
144
163
this ::routeLinkInteraction ),
145
164
path (GlobalConstants .SEGMENT_PROXY_POST_LINK_INTERACTION_TO_GID ,
146
165
this ::routeLinkInteractionToGid ),
147
- path (GlobalConstants .SEGMENT_PROXY_ON_NOTIFICATION_RESOLUTION ,
148
- () -> onNotificationResolution (actorSystem , backEnd )))),
166
+ path (GlobalConstants .SEGMENT_PROXY_ON_NOTIFICATION_RESOLUTION ,
167
+ () -> onNotificationResolution (actorSystem , backEnd )))),
149
168
get (() -> concat (path ("mu" , this ::routeMU ),
150
169
path (GlobalConstants .SEGMENT_PROXY_GET_DASHBOARD_DATA ,
151
- () -> routeDashboardData (actorSystem , backEnd ))
170
+ () -> routeDashboardData (actorSystem , backEnd ))
152
171
))));
153
172
}
154
173
0 commit comments