diff --git a/subscription-service/config/detekt/baseline.xml b/subscription-service/config/detekt/baseline.xml
index acbf2b82d..1471fb12d 100644
--- a/subscription-service/config/detekt/baseline.xml
+++ b/subscription-service/config/detekt/baseline.xml
@@ -4,7 +4,7 @@
CyclomaticComplexMethod:SubscriptionServiceTests.kt$SubscriptionServiceTests$@Test fun `it should load a subscription with all possible members`()
LongMethod:EntityEventListenerService.kt$EntityEventListenerService$internal suspend fun dispatchEntityEvent(content: String)
- LongParameterList:FixtureUtils.kt$( withQueryAndGeoQuery: Pair<Boolean, Boolean> = Pair(true, true), withEndpointInfo: Boolean = true, withNotifParams: Pair<FormatType, List<String>> = Pair(FormatType.NORMALIZED, emptyList()), withModifiedAt: Boolean = false, georel: String = "within", geometry: String = "Polygon", coordinates: String = "[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]", timeInterval: Int? = null, contexts: List<String> = listOf(NGSILD_CORE_CONTEXT) )
+ LongParameterList:FixtureUtils.kt$( withQueryAndGeoQuery: Pair<Boolean, Boolean> = Pair(true, true), withEndpointReceiverInfo: Boolean = true, withNotifParams: Pair<FormatType, List<String>> = Pair(FormatType.NORMALIZED, emptyList()), withModifiedAt: Boolean = false, georel: String = "within", geometry: String = "Polygon", coordinates: String = "[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]", timeInterval: Int? = null, contexts: List<String> = listOf(NGSILD_CORE_CONTEXT) )
TooGenericExceptionCaught:SubscriptionService.kt$SubscriptionService$e: Exception
TooManyFunctions:SubscriptionService.kt$SubscriptionService
diff --git a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/model/Endpoint.kt b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/model/Endpoint.kt
index b8affa53f..ec293fda5 100644
--- a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/model/Endpoint.kt
+++ b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/model/Endpoint.kt
@@ -7,7 +7,8 @@ import java.net.URI
data class Endpoint(
val uri: URI,
val accept: AcceptType = JSON,
- val info: List? = null
+ val receiverInfo: List? = null,
+ val notifierInfo: List? = null
) {
enum class AcceptType(val accept: String) {
diff --git a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/NotificationService.kt b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/NotificationService.kt
index 6e6c35a4e..7a2dfc0fb 100644
--- a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/NotificationService.kt
+++ b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/NotificationService.kt
@@ -69,7 +69,7 @@ class NotificationService(
}
if (tenantUri != DEFAULT_TENANT_URI)
it.set(NGSILD_TENANT_HEADER, tenantUri.toString())
- subscription.notification.endpoint.info?.forEach { endpointInfo ->
+ subscription.notification.endpoint.receiverInfo?.forEach { endpointInfo ->
it.set(endpointInfo.key, endpointInfo.value)
}
}
diff --git a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/SubscriptionService.kt b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/SubscriptionService.kt
index eabacef22..fd9f5305a 100644
--- a/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/SubscriptionService.kt
+++ b/subscription-service/src/main/kotlin/com/egm/stellio/subscription/service/SubscriptionService.kt
@@ -127,15 +127,18 @@ class SubscriptionService(
if (subscription.geoQ != null)
parseGeoQueryParameters(subscription.geoQ.toMap(), subscription.contexts).bind()
else null
+ val endpoint = subscription.notification.endpoint
val insertStatement =
"""
INSERT INTO subscription(id, type, subscription_name, created_at, description, watched_attributes,
notification_trigger, time_interval, q, scope_q, notif_attributes, notif_format, endpoint_uri,
- endpoint_accept, endpoint_info, times_sent, is_active, expires_at, sub, contexts)
+ endpoint_accept, endpoint_receiver_info, endpoint_notifier_info, times_sent, is_active,
+ expires_at, sub, contexts)
VALUES(:id, :type, :subscription_name, :created_at, :description, :watched_attributes,
:notification_trigger, :time_interval, :q, :scope_q, :notif_attributes, :notif_format, :endpoint_uri,
- :endpoint_accept, :endpoint_info, :times_sent, :is_active, :expires_at, :sub, :contexts)
+ :endpoint_accept, :endpoint_receiver_info, :endpoint_notifier_info, :times_sent, :is_active,
+ :expires_at, :sub, :contexts)
""".trimIndent()
databaseClient.sql(insertStatement)
@@ -151,9 +154,10 @@ class SubscriptionService(
.bind("scope_q", subscription.scopeQ)
.bind("notif_attributes", subscription.notification.attributes?.joinToString(separator = ","))
.bind("notif_format", subscription.notification.format.name)
- .bind("endpoint_uri", subscription.notification.endpoint.uri)
- .bind("endpoint_accept", subscription.notification.endpoint.accept.name)
- .bind("endpoint_info", Json.of(endpointInfoToString(subscription.notification.endpoint.info)))
+ .bind("endpoint_uri", endpoint.uri)
+ .bind("endpoint_accept", endpoint.accept.name)
+ .bind("endpoint_receiver_info", Json.of(endpointInfoToString(endpoint.receiverInfo)))
+ .bind("endpoint_notifier_info", Json.of(endpointInfoToString(endpoint.notifierInfo)))
.bind("times_sent", subscription.notification.timesSent)
.bind("is_active", subscription.isActive)
.bind("expires_at", subscription.expiresAt)
@@ -226,10 +230,10 @@ class SubscriptionService(
"""
SELECT subscription.id as sub_id, subscription.type as sub_type, subscription_name, created_at,
modified_at, description, watched_attributes, notification_trigger, time_interval, q, notif_attributes,
- notif_format, endpoint_uri, endpoint_accept, endpoint_info, status, times_sent, is_active,
- last_notification, last_failure, last_success, entity_selector.id as entity_id, id_pattern,
- entity_selector.type_selection as type_selection, georel, geometry, coordinates, pgis_geometry,
- geoproperty, scope_q, expires_at, contexts
+ notif_format, endpoint_uri, endpoint_accept, endpoint_receiver_info, endpoint_notifier_info, status,
+ times_sent, is_active, last_notification, last_failure, last_success, entity_selector.id as entity_id,
+ id_pattern, entity_selector.type_selection as type_selection, georel, geometry, coordinates,
+ pgis_geometry, geoproperty, scope_q, expires_at, contexts
FROM subscription
LEFT JOIN entity_selector ON entity_selector.subscription_id = :id
LEFT JOIN geometry_query ON geometry_query.subscription_id = :id
@@ -427,12 +431,14 @@ class SubscriptionService(
Endpoint.AcceptType.JSON.name
else
Endpoint.AcceptType.JSONLD.name
- val endpointInfo = endpoint["info"] as? List