Notifications sent with eventType LOGISTICS_OBJECT_CREATED when Subscription is set up for LOGISTICS_EVENT_RECEIVED
Tested with two neone instances and initiated Subscription for LOGISTICS_OBJECT_TYPE = https://onerecord.iata.org/ns/cargo#Waybill:
{
"@context": {
"cargo": "https://onerecord.iata.org/ns/cargo#",
"api": "https://onerecord.iata.org/ns/api#"
},
"@type": "api:Subscription",
"api:hasContentType": "application/ld+json",
"api:hasSubscriber": {
"@id": "http://ne-one-1:8080/logistics-objects/_data_holder"
},
"api:hasTopicType": {
"@id": "api:LOGISTICS_OBJECT_TYPE"
},
"api:includeSubscriptionEventType": [
{
"@id": "api:LOGISTICS_EVENT_RECEIVED"
},
{
"@id": "api:LOGISTICS_OBJECT_UPDATED"
},
{
"@id": "api:LOGISTICS_OBJECT_CREATED"
}
],
"api:hasTopic": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "https://onerecord.iata.org/ns/cargo#Waybill"
}
}
This results in action-request on publisher server:
{
"@graph": [
{
"@id": "http://localhost:8081/action-requests/8c5d5da1-0847-466e-addd-dff91d2f27cf",
"@type": "https://onerecord.iata.org/ns/api#SubscriptionRequest",
"https://onerecord.iata.org/ns/api#hasRequestStatus": {
"@id": "https://onerecord.iata.org/ns/api#REQUEST_ACCEPTED"
},
"https://onerecord.iata.org/ns/api#hasSubscription": {
"@id": "http://localhost:8081/subscriptions/bdd87c75-f515-4f56-afec-f3af45b9f84e"
},
"https://onerecord.iata.org/ns/api#isRequestedAt": {
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
"@value": "2024-12-06T08:50:29.910571927Z"
},
"https://onerecord.iata.org/ns/api#isRequestedBy": {
"@id": "http://ne-one-1:8080/logistics-objects/_data_holder"
}
},
{
"@id": "http://localhost:8081/subscriptions/bdd87c75-f515-4f56-afec-f3af45b9f84e",
"@type": "https://onerecord.iata.org/ns/api#Subscription",
"https://onerecord.iata.org/ns/api#hasSubscriber": {
"@id": "http://ne-one-1:8080/logistics-objects/_data_holder"
},
"https://onerecord.iata.org/ns/api#hasSupportedContentType": [
"application/ld+json",
"application/x-turtle",
"text/turtle"
],
"https://onerecord.iata.org/ns/api#hasTopic": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "https://onerecord.iata.org/ns/cargo#Waybill"
},
"https://onerecord.iata.org/ns/api#hasTopicType": {
"@id": "https://onerecord.iata.org/ns/api#LOGISTICS_OBJECT_TYPE"
},
"https://onerecord.iata.org/ns/api#includeSubscriptionEventType": "https://onerecord.iata.org/ns/api#LOGISTICS_EVENT_RECEIVED"
}
]
}
As already reported in #212 includeSubscriptionEventType only contains a single String of the requested EventTypes to be included for the Subscription. As a next step a Waybill object was created on the publisher server which resulted in a Notification being sent to the subscriber server:
{
"@graph": [
{
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf",
"@type": [
"https://onerecord.iata.org/ns/cargo#LogisticsObject",
"https://onerecord.iata.org/ns/cargo#Waybill"
],
"https://onerecord.iata.org/ns/cargo#arrivalLocation": {
"@id": "http://localhost:8081/logistics-objects/airport-SFO"
},
"https://onerecord.iata.org/ns/cargo#departureLocation": {
"@id": "http://localhost:8081/logistics-objects/airport-FRA"
},
"https://onerecord.iata.org/ns/cargo#shipment": {
"@id": "http://localhost:8081/logistics-objects/67d8834e-cffd-4bc3-bafb-2ac3a28d5e74"
},
"https://onerecord.iata.org/ns/cargo#waybillNumber": "10323165",
"https://onerecord.iata.org/ns/cargo#waybillPrefix": "020",
"https://onerecord.iata.org/ns/cargo#waybillType": {
"@id": "https://onerecord.iata.org/ns/cargo#MASTER"
}
},
{
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf/notifications/6bcec3c4-7fac-4446-b612-b42431755c86",
"@type": "Notification",
"hasEventType": {
"@id": "https://onerecord.iata.org/ns/api#LOGISTICS_OBJECT_CREATED"
},
"hasLogisticsObject": {
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf"
},
"hasLogisticsObjectType": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "https://onerecord.iata.org/ns/cargo#Waybill"
}
}
],
"@context": {
"@vocab": "https://onerecord.iata.org/ns/api#"
}
}
When adding a LogisticsEvent on the shipment now, the Notification seen above is sent out again. Although the LogisticsEvent has been added on the shipment the Notification still refers to the Waybill object with EventType = LOGISTICS_OBJECT_CREATED. This behaviour seems a bit confusing to me. On the other hand when I add a LogisticsEvent on the Waybill itself this Notification is sent to the subscriber server:
{
"@graph": [
{
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf",
"@type": [
"https://onerecord.iata.org/ns/cargo#LogisticsObject",
"https://onerecord.iata.org/ns/cargo#Waybill"
],
"https://onerecord.iata.org/ns/cargo#arrivalLocation": {
"@id": "http://localhost:8081/logistics-objects/airport-SFO"
},
"https://onerecord.iata.org/ns/cargo#departureLocation": {
"@id": "http://localhost:8081/logistics-objects/airport-FRA"
},
"https://onerecord.iata.org/ns/cargo#shipment": {
"@id": "http://localhost:8081/logistics-objects/67d8834e-cffd-4bc3-bafb-2ac3a28d5e74"
},
"https://onerecord.iata.org/ns/cargo#waybillNumber": "10323165",
"https://onerecord.iata.org/ns/cargo#waybillPrefix": "020",
"https://onerecord.iata.org/ns/cargo#waybillType": {
"@id": "https://onerecord.iata.org/ns/cargo#MASTER"
}
},
{
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf/notifications/fb44083f-55e1-489b-b92b-548b9a8b0695",
"@type": "Notification",
"hasEventType": {
"@id": "https://onerecord.iata.org/ns/api#LOGISTICS_EVENT_RECEIVED"
},
"hasLogisticsObject": {
"@id": "http://localhost:8081/logistics-objects/0f622b80-c20b-4f07-bb44-cb618ca82baf"
},
"hasLogisticsObjectType": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "https://onerecord.iata.org/ns/cargo#Waybill"
}
}
],
"@context": {
"@vocab": "https://onerecord.iata.org/ns/api#"
}
}
This seems more logical and is correct according to the API specification.