How to access reference data needed in entity processing flows?

As an example, consider the processing flow when an entity receives a command. In some cases, it is necessary to retrieve reference data to validate the incoming request, e.g., validate customer id, validate product id, etc.

Performing a reference data lookup will often require hitting a database. These types of operations will interrupt the entity processing flow while it waits for the reference data lookup.

The assumption is that a future or promise will be used, depending on the language. It will also be necessary to handle different targets, such as views, other ASLS services, and external services.

It would be great if these types of operations are handled/abstracted by Akka Serverless.

Should also mention that accessing reference data will be needed from actions and views. For example, in a view while processing an event, enrich the event data with additional reference data.

There are a few ways you could do that and based on your use case you’ll have to select the one that fits best.

In your user function you could make a call to the external service you’re trying to get data from. That way your user function is in control of making the request, handling the response, and making a decision whether or not to do something with it. It is a little similar to what I do in this example:

const validator = new JWTValidator('X-Custom-JWT-Auth', 'https://<your tenant>');
try {
    await validator.validateAndDecode(context.metadata);
    return {
        message: `${request.greeting}, ${}!`
} catch (err) { 

The JWTValidator calls out to Auth0 to validate a token and based on that continues or not (and could use the enriched data afterwards). You could do something similar using gRPC clients too.

A second alternative would be to leverage the messaging feature in Akka Serverless. Though it’ll be asynchronous, so your design has to support that, it’s certainly an option to consider.

If you have any specific thoughts let us know!


We have a specific use case in regards to enrichment for views.
There are 3 AS services (user, inventory and trade).
Trade service state contains user_ids (buyer, seller) and items_ids (items to buy and items to trade).
Trade service needs to build a view with user and item enriched information (user’s name and surname & item’s name and imageUrl).
Trade service View handler should , on TradeOffered event, call user and item service for each user_id and item_id, extract required information from the response and return a view’s DTO.
We want to use a Java SDK but we see few challenges:

  • View class is not an async function. Does that meen that we need to use blocking?
  • For calling user and item service, I assume we would need to use ServiceCallRef. How can we combine these multiple executions and extract result to be able to return a DTO?

Thank you

Got some feedback on this and would like to share it here.
Action and view execution is done in AS sidecar and not in user function meaning that this kind of functionality where multiple executions needs to be done in one “handler” is not possible.
This would be a good feature to have.

One additional use case is subscribe on event that has a list of ids. For each id command needs to issue a command to a separate entity instance. For now we are limited to issue only one command per subscribed event