Skip to content

@purista/base-http-bridge v2.0.5


PURISTA API / @purista/base-http-bridge / HttpEventBridgeClient

Interface: HttpEventBridgeClient

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:7

The HttpEventBridgeClient connects the HTTPEventBridge with the sidecar service. This client is responsible for the communication to the sidecar service.

Properties

getApiPathForCommand()

getApiPathForCommand: (addess, metadata) => string

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:22

Generate the url path of the command based on the command builder exposeAsHttpEndpoint settings. This url is a POST endpoint and expects the payload and parameter as defined for exposing.

Parameters

addess

EBMessageAddress

metadata
expose

object & object

Returns

string

url path of endpoint


getInternalPathForCommand()

getInternalPathForCommand: (address) => string

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:14

Generate the url path of the command. This url is a POST endpoint and expects a command message as payload

Parameters

address

EBMessageAddress

Returns

string

url path of endpoint


getInternalPathForSubscription()

getInternalPathForSubscription: (address) => string

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:31

Generate the url path of the subscription. This url is a POST endpoint. The expected payload is a EBMessage or an CloudEvent with an EBMessage as data depending on config settings

Parameters

address

EBMessageAddress

Returns

string

url path of endpoint


invoke()

invoke: (command, headers?, timeout?) => Promise<CommandResponse>

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:40

Invoke a command

Parameters

command

Command

contentEncoding

string

content encoding of message payload

contentType

string

content type of message payload

correlationId

string

correlation id to know which command response referrs to which command

eventName?

string

event name for this message

id

string

global unique id of message

messageType

Command

otp?

string

stringified Opentelemetry parent trace id

payload

{ parameter: unknown; payload: unknown; }

payload.parameter

unknown

payload.payload

unknown

principalId?

string

principal id

receiver

EBMessageAddress

sender

{ instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string; }

sender.instanceId

string

instance id of eventbridge

sender.serviceName

string

the name of the service

sender.serviceTarget

string

the name of the command or subscription

sender.serviceVersion

string

the version of the service

tenantId?

string

principal id

timestamp

number

timestamp of message creation time

traceId?

string

trace id of message

headers?

Record<string, string>

optional HTTP header

timeout?

number

the command timeout

Returns

Promise<CommandResponse>


isSidecarAvailable()

isSidecarAvailable: () => Promise<boolean>

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:54

Checks if the sidecar container is available to be able to send events and invoke commands

Returns

Promise<boolean>

boolean


sendEvent()

sendEvent: (message, headers?) => Promise<void>

Defined in: base-http-bridge/src/HttpEventBridge/types/HttpEventBridgeClient.ts:48

Send a EBMessage as event to the underlaying message infrastructure.

Parameters

message

EBMessage

headers?

Record<string, string>

Returns

Promise<void>