Class: Action

akkaserverless. Action

An action.


new Action(desc, serviceName [, options])

Create a new action.

Parameters:
Name Type Argument Description
desc string | Array.<string>

A descriptor or list of descriptors to parse, containing the service to serve.

serviceName string

The fully qualified name of the service that provides this interface.

options module:akkaserverless.Action~options <optional>

The options for this action

Implements:

Members


commandHandlers :Object.<string, module:akkaserverless.Action.ActionCommandHandler>

The command handlers.

The names of the properties must match the names of the service calls specified in the gRPC descriptor

Type:

options :module:akkaserverless.Action~options

Type:

service :protobuf.Service

Type:
  • protobuf.Service

serviceName :string

Type:
  • string

Methods


componentType()

Returns:

action component type.

Type
string

lookupType(messageType)

Lookup a protobuf message type.

This is provided as a convenience to lookup protobuf message types for use with events and snapshots.

Parameters:
Name Type Description
messageType string

The fully qualified name of the type to lookup.

Returns:

The protobuf message type.

Type
protobuf.Type

setCommandHandlers(handlers)

Set the command handlers for this action.

Parameters:
Name Type Description
handlers Object.<string, module:akkaserverless.Action.ActionCommandHandler>

The command handlers.

Returns:

This action.

Type
module:akkaserverless.Action

Type Definitions


ActionCommandHandler

An action command handler.

Type:

options

Options for an action.

Properties:
Name Type Argument Default Description
includeDirs array.<string> <optional>
["."]

The directories to include when looking up imported protobuf files.

forwardHeaders array.<string> <optional>
[]

request headers to be forwarded as metadata to the action


streamedCommandHandler(context)

A streamed command handler.

Parameters:
Name Type Description
context module:akkaserverless.Action.StreamedCommandContext

The command context.


streamedInCommandHandler(context)

A streamed in action command handler.

Parameters:
Name Type Description
context module:akkaserverless.Action.StreamedInCommandContext

The command context.

Returns:

The message to reply with, it must match the gRPC service call output type for this command. If replying by using context.write, undefined must be returned.

Type
undefined | Object | Promise.<any>

streamedOutCommandHandler(command, context)

A streamed out command handler.

Parameters:
Name Type Description
command Object

The command message, this will be of the type of the gRPC service call input type.

context module:akkaserverless.Action.StreamedOutCommandContext

The command context.


unaryCommandHandler(command, context)

A unary action command handler.

Parameters:
Name Type Description
command Object

The command message, this will be of the type of the gRPC service call input type.

context module:akkaserverless.Action.UnaryCommandContext

The command context.

Returns:

The message to reply with, it must match the gRPC service call output type for this command. If replying by using context.write, undefined must be returned.

Type
undefined | Object | Promise.<any> | module:akkaserverless.replies.Reply