kronos-endpoint
Named communication (end)-points inside of kronos
API
Table of Contents
Endpoint
Parameters
name
string endpoint nameowner
Object of the endpoint (service or step)options
Object (optional, default {}
)
options.opposite
Endpoint? opposite endpointoptions.createOpposite
boolean? true to auto create an opposite endpoint
isDefault
Indicate whatever we are a default endpoint.
Default means buildin.
Returns boolean false
isIn
Returns boolean false
isOut
Returns boolean false
isOpen
Returns boolean false
isConnected
Returns boolean false
direction
Deliver data flow direction
Returns string delivers data flow direction 'in', 'out' or undefined
opposite
Deliver the opposite endpoint
Returns Endpoint representing the opposite direction
InterceptedEndpoint
Extends Endpoint
Endpoint with a list of interceptors
also provides fistInterceptor and lastInterceptor
hasInterceptors
Returns boolean true if there is at least one interceptor assigned
interceptors
Deliver array of all assigned interceptors
Returns Array<Interceptor> the interceptors or empty array if none are present
interceptors
Set the interceptors
a connected chain from array element 0 over all entries up to the last element
in the array is formed.
Additionally firstInterceptor and lastInterceptor are set.
Parameters
newInterceptors
Array<Interceptor> replaces all interceptors
ReceiveEndpoint
Extends InterceptedEndpoint
Receiving Endpoint
by default a dummy rejecting receiver is assigned
Parameters
connected
Connect other side to us
Parameters
other
Endpoint endpoint to be connected to
sender
Deliver the sending side Endpoint
Returns SendEndpoint the sending side
receive
get the recive function
Returns Function
receive
Set the recive function
If we know the sender we will inform him about our open/close state
by calling willBeClosed() and hasBeenOpened()
Parameters
receive
Function (optional, default rejectingReceiver
)
isOpen
Are we able to receive requests
Returns boolean true if we are able to receive requests
isIn
We are always in
Returns boolean always true
ReceiveEndpointDefault
Extends ReceiveEndpoint
Receive Endpoint acting as a default endpoints
isDefault
We are a default endpoint
Returns boolean always true
SendEndpoint
Extends ConnectorMixin(InterceptedEndpoint)
Sending Endpoint
Parameters
name
string endpoint nameowner
Object of the endpoint (service or step)options
Object (optional, default {}
)
options.opposite
Endpoint? endpoint going into the opposite directionoptions.hasBeenConnected
Function? called after connectedoptions.hasBeenDisconected
Function? called after disconnectedoptions.hasBeenOpened
Function? called after receiver is openoptions.willBeClosed
Function? called before receiver is closed
isOut
We are always out
Returns boolean always true
SendEndpointDefault
Extends SendEndpoint
Send Endpoint acting as a default endpoints
isDefault
We are a default endpoint
Returns boolean always true
isEndpoint
check for Endpoint
Parameters
Returns boolean true if object is a Endpoint
install
With npm do:
npm install kronos-endpoint
license
BSD-2-Clause