Expand my Community achievements bar.

SOLVED

While fetching events from journal api, do we persist the `last` event position

Avatar

Level 6

I am experimenting https://developer.adobe.com/events/docs/guides/api/journaling_api/#fetching-your-first-batch-of-even...

I am trying to create action as event subscriber, read event and create assets in aem.

 

I was able to create provider, register event and submit a sample event into the journal. Next I am able to fetch the event from journal queue. I created an adobe io action, and from node, able to receive events and call assetcompute services. All good.

 

Now my question is, do we persist the `last` event position? Since event is consumed by  adobeio action , I cant keep in-memory. I have persist, and only storage is AEM, under some /var node property. Is this normal? In general when reading from Journal, from cloud microservice, do we persist last, so next time wen service wakes up, if can fetch `since` last. What is the general practice?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee
Employee

Hi @sarav_prakash 

 

Yes, you must store the last position to fetch the next batch of events. However, we recommend looking at the `link` response headers  with rel="next" and persisting that URL to fetch the next batch of events.

See: https://developer.adobe.com/events/docs/guides/api/journaling_api/#fetching-the-next-batch-of-newer-... 

 

If you are building your application with App Builder, you can use the State service to persist the link. 

See: https://developer.adobe.com/app-builder/docs/guides/application_state/

 

Thanks
Manik

 

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee
Employee

Hi @sarav_prakash 

 

Yes, you must store the last position to fetch the next batch of events. However, we recommend looking at the `link` response headers  with rel="next" and persisting that URL to fetch the next batch of events.

See: https://developer.adobe.com/events/docs/guides/api/journaling_api/#fetching-the-next-batch-of-newer-... 

 

If you are building your application with App Builder, you can use the State service to persist the link. 

See: https://developer.adobe.com/app-builder/docs/guides/application_state/

 

Thanks
Manik