Skip to content

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

Interface: HttpEventBridgeClient

@purista/base-http-bridge.HttpEventBridgeClient

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

Table of contents

Properties

Properties

getApiPathForCommand

getApiPathForCommand: (addess: EBMessageAddress, metadata: { expose: { contentEncodingRequest?: string ; contentEncodingResponse?: string ; contentTypeRequest?: string ; contentTypeResponse?: string ; deprecated?: boolean ; inputPayload?: SchemaObject ; outputPayload?: SchemaObject ; parameter?: SchemaObject } & { http: { method: "POST" | "PUT" | "PATCH" | "GET" | "DELETE" ; openApi?: { additionalStatusCodes?: StatusCode[] ; description: string ; isSecure: boolean ; operationId?: string ; query?: QueryParameter<{}>[] ; summary: string ; tags?: string[] } ; path: string } } }) => string

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.

Param

Type declaration

▸ (addess, metadata): string

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
NameType
addessEBMessageAddress
metadataObject
metadata.expose{ contentEncodingRequest?: string ; contentEncodingResponse?: string ; contentTypeRequest?: string ; contentTypeResponse?: string ; deprecated?: boolean ; inputPayload?: SchemaObject ; outputPayload?: SchemaObject ; parameter?: SchemaObject } & { http: { method: "POST" | "PUT" | "PATCH" | "GET" | "DELETE" ; openApi?: { additionalStatusCodes?: StatusCode[] ; description: string ; isSecure: boolean ; operationId?: string ; query?: QueryParameter<{}>[] ; summary: string ; tags?: string[] } ; path: string } }
Returns

string

url path of endpoint

Defined in

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


getInternalPathForCommand

getInternalPathForCommand: (address: EBMessageAddress) => string

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

Param

Type declaration

▸ (address): string

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

Parameters
NameType
addressEBMessageAddress
Returns

string

url path of endpoint

Defined in

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


getInternalPathForSubscription

getInternalPathForSubscription: (address: EBMessageAddress) => string

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

Param

Type declaration

▸ (address): string

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
NameType
addressEBMessageAddress
Returns

string

url path of endpoint

Defined in

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


invoke

invoke: (command: { contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: unknown ; payload: unknown } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }, headers?: Record<string, string>, timeout?: number) => Promise<CommandResponse>

Invoke a command

Param

Command

Param

optional HTTP header

Param

the command timeout

Type declaration

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

Invoke a command

Parameters
NameTypeDescription
commandObjectCommand
command.contentEncodingstringcontent encoding of message payload
command.contentTypestringcontent type of message payload
command.correlationIdstringcorrelation id to know which command response referrs to which command
command.eventName?stringevent name for this message
command.idstringglobal unique id of message
command.messageTypeCommand-
command.otp?stringstringified Opentelemetry parent trace id
command.payloadObject-
command.payload.parameterunknown-
command.payload.payloadunknown-
command.principalId?stringprincipal id
command.receiverEBMessageAddress-
command.senderObject-
command.sender.instanceIdstringinstance id of eventbridge
command.sender.serviceNamestringthe name of the service
command.sender.serviceTargetstringthe name of the command or subscription
command.sender.serviceVersionstringthe version of the service
command.tenantId?stringprincipal id
command.timestampnumbertimestamp of message creation time
command.traceId?stringtrace id of message
headers?Record<string, string>optional HTTP header
timeout?numberthe command timeout
Returns

Promise<CommandResponse>

Defined in

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


isSidecarAvailable

isSidecarAvailable: () => Promise<boolean>

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

Type declaration

▸ (): Promise<boolean>

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

Returns

Promise<boolean>

boolean

Defined in

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


sendEvent

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

Send a EBMessage as event to the underlaying message infrastructure.

Param

Param

Type declaration

▸ (message, headers?): Promise<void>

Send a EBMessage as event to the underlaying message infrastructure.

Parameters
NameType
messageEBMessage
headers?Record<string, string>
Returns

Promise<void>

Defined in

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