Share via


Entity Class

Durable Entity Class.

Responsible for executing the user-defined entity function.

Create a new entity for the user-defined entity.

Responsible for executing the user-defined entity function

Constructor

Entity(entity_func: Callable[[DurableEntityContext], None])

Parameters

Name Description
entity_func
Required
<xref:Callable>[[<xref:DurableEntityContext>], <xref:Generator>[<xref:Any>, Any, <xref:Any>]]

The user defined entity function

Methods

create

Create an instance of the entity class.

handle

Handle the execution of the user-defined entity function.

Loops over the batch, which serves to specify inputs to the entity, and collects results and generates a final state, which are returned.

create

Create an instance of the entity class.

create(fn: Callable[[DurableEntityContext], None]) -> Callable[[Any], str]

Parameters

Name Description
None])
Required
) ([<xref:description>]
fn
Required

Returns

Type Description

Handle function of the newly created entity client

handle

Handle the execution of the user-defined entity function.

Loops over the batch, which serves to specify inputs to the entity, and collects results and generates a final state, which are returned.

handle(context: DurableEntityContext, batch: List[Dict[str, Any]]) -> str

Parameters

Name Description
context
Required
<xref:azure.durable_functions.entity.DurableEntityContext>

The entity context of the entity, which the user interacts with as their Durable API

batch
Required

Returns

Type Description
str

A JSON-formatted string representing the output state, results, and exceptions for the entity execution.