Skip to content

Commit 9e71626

Browse files
gasper-vrhovsekctomc
authored andcommitted
Fix missing session id on subscription events
1 parent ecde261 commit 9e71626

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

extension/runtime/src/main/java/org/iris_events/producer/RoutingDetails.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@ public final class RoutingDetails {
1212
private final String routingKey;
1313
private final Scope scope;
1414
private final String userId;
15+
private final String sessionId;
1516
private final String subscriptionId;
1617
private final boolean persistent;
1718
private final Integer cacheTtl;
1819
private final boolean propagate;
1920

2021
public RoutingDetails(final String eventName, final String exchange, final ExchangeType exchangeType,
21-
final String routingKey, final Scope scope, final String userId,
22+
final String routingKey, final Scope scope, final String userId, final String sessionId,
2223
final String subscriptionId, final boolean persistent, final Integer cacheTtl, final boolean propagate) {
2324
this.eventName = eventName;
2425
this.exchange = exchange;
2526
this.exchangeType = exchangeType;
2627
this.routingKey = routingKey;
2728
this.scope = scope;
2829
this.userId = userId;
30+
this.sessionId = sessionId;
2931
this.subscriptionId = subscriptionId;
3032
this.persistent = persistent;
3133
this.cacheTtl = cacheTtl;
@@ -56,6 +58,10 @@ public String getUserId() {
5658
return userId;
5759
}
5860

61+
public String getSessionId() {
62+
return sessionId;
63+
}
64+
5965
public String getSubscriptionId() {
6066
return subscriptionId;
6167
}
@@ -203,6 +209,11 @@ public MiscRoutingDetailsBuilder userId(final String userId) {
203209
return this;
204210
}
205211

212+
public MiscRoutingDetailsBuilder sessionId(final String sessionId) {
213+
this.sessionId = sessionId;
214+
return this;
215+
}
216+
206217
public MiscRoutingDetailsBuilder subscriptionId(final String subscriptionId) {
207218
this.subscriptionId = subscriptionId;
208219
return this;
@@ -224,7 +235,7 @@ public MiscRoutingDetailsBuilder propagate(final boolean propagate) {
224235
}
225236

226237
public RoutingDetails build() {
227-
return new RoutingDetails(eventName, exchange, exchangeType, routingKey, scope, userId, subscriptionId,
238+
return new RoutingDetails(eventName, exchange, exchangeType, routingKey, scope, userId, sessionId, subscriptionId,
228239
persistent, cacheTtl, propagate);
229240
}
230241
}

extension/runtime/src/main/java/org/iris_events/runtime/BasicPropertiesProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ private AMQP.BasicProperties buildAmqpBasicPropertiesWithCustomHeaders(final AMQ
106106
final var eventName = routingDetails.getEventName();
107107
final var scope = routingDetails.getScope();
108108
final var userId = routingDetails.getUserId();
109+
final var sessionId = routingDetails.getSessionId();
109110
final var propagate = routingDetails.getPropagate();
110111
final var subscriptionId = routingDetails.getSubscriptionId();
111112
final var cacheTtl = routingDetails.getCacheTtl();
@@ -118,6 +119,7 @@ private AMQP.BasicProperties buildAmqpBasicPropertiesWithCustomHeaders(final AMQ
118119
headers.put(EVENT_TYPE, eventName);
119120
headers.put(SERVER_TIMESTAMP, timestampProvider.getCurrentTimestamp());
120121
Optional.ofNullable(subscriptionId).ifPresent(id -> headers.put(SUBSCRIPTION_ID, id));
122+
Optional.ofNullable(sessionId).ifPresent(sId -> headers.put(SESSION_ID, sId));
121123
Optional.ofNullable(cacheTtl).ifPresent(ttl -> headers.put(CACHE_TTL, ttl));
122124

123125
if (scope != Scope.INTERNAL) {

0 commit comments

Comments
 (0)