Skip to main content

Interface: HttpEventBridgeClient


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: "DELETE" | "GET" | "PATCH" | "POST" | "PUT" ; openApi?: { additionalStatusCodes?: StatusCode[] ; description: string ; isSecure: boolean ; operationId?: string ; query?: QueryParameter<{}>[] ; summary: string ; tags?: string[] } ; path: string } } }) => string

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: "DELETE" | "GET" | "PATCH" | "POST" | "PUT" ; 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:22open in new window


getInternalPathForCommand

getInternalPathForCommand: (address: EBMessageAddress) => string

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:14open in new window


getInternalPathForSubscription

getInternalPathForSubscription: (address: EBMessageAddress) => string

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:31open in new window


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: { serviceName: string; serviceVersion: string; serviceTarget: string; instanceId: string; } ; tenantId?: string ; timestamp: number ; traceId?: string }, headers?: Record<string, string>, timeout?: number) => Promise<CommandResponse>

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.sender{ serviceName: string; serviceVersion: string; serviceTarget: string; instanceId: string; }-
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:40open in new window


isSidecarAvailable

isSidecarAvailable: () => Promise<boolean>

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:54open in new window


sendEvent

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

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:48open in new window

Last update:
Contributors: Sebastian Wessel