To make development easier, Actors can now be called in 2 ways:
- By creating an actor through a helper method in the
DaprClient
class, removing the need of needing to know how a builder works.
const actor = await client.actor.create<DemoActorSayImpl>(DemoActorSayImpl);
const res = await actor.sayMulti(123, "123", { hello: "world 123" }, [1, 2, 3]);
- By utilizing the Actor builder, where we create a Proxy object that does this for us.
const builder = new ActorProxyBuilder<DemoActorSayImpl>(DemoActorSayImpl, client);
const actor = builder.build(ActorId.createRandomId());
const res = await actor.sayMulti(123, "123", { hello: "world 123" }, [1, 2, 3]);
Behind the hoods, method #1 will utilize method #2
Version 2.0.0 brings a lot of changes to the Dapr JS SDK that were long due. Below an overview of the major contributions can be found, with a more detailed overview of the Breaking Changes under it.
- Actor Support has been added
- Actor Proxy has been added for Actor Access
- The HTTP Connection is now being reused to reduce the CONNRESET errors when intensively using the JS SDK
- The Metadata API is supported
- The Health API is supported
- The
/v1.0/shutdown
API endpoint is now supported by callingawait client.sidecar.shutdown()
DaprServer.ts
:startServer()
,stopServer()
have been renamed tostart()
andstop()
this means thatawait server.startServer()
will now be called asawait server.start()
DaprServer.ts
:close()
has been removed in favor ofstop()
- KeepAlive for HTTP has been added and a new method in the
DaprClient
has been added namedstop()
to stop the client and release the connections kept by the sockets. healthz
endpoint was implemented asclient.health.isHealthy()
for gRPC this checks thegetMetadata
function since it does not have a Health PROTO.- Server startup now ensures the Dapr Sidecar is healthy before starting
- Add metadata API for gRPC and HTTP
- Add the SDK implementation for gRPC and HTTP for shutting down the Sidecar through the SDK