While fetching events from journal api, do we persist the `last` event position | Community
Skip to main content
sarav_prakash
Community Advisor
Community Advisor
August 4, 2024
Solved

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

  • August 4, 2024
  • 1 reply
  • 905 views

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

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by tmj

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-events-from-the-journal 

 

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

 

 

1 reply

tmj
Adobe Employee
tmjAdobe EmployeeAccepted solution
Adobe Employee
August 5, 2024

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-events-from-the-journal 

 

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

 

 

sarav_prakash
Community Advisor
Community Advisor
August 9, 2024

thanks tmj. this will help me.