import MessageFactory from 'service-framework/src/message-factory/MessageFactory.js'
MessageFactory
Constructor Summary
Public Constructor | ||
public |
Constructor to be used to instantiate an object of the Message Factory |
Member Summary
Public Members | ||
public |
myGenerator: * |
Method Summary
Public Methods | ||
public |
createCreateMessageRequest(from: URL.URL, to-: URL.URLList, value: String, policy: URL.URL): * Creates a Message of TYPE CREATE and Create Message Body |
|
public |
createDeleteMessageRequest(from: URL.URL, to: URL.URLList, resource: URL.URl, attribute: *): Message.Message Create Delete Message of Type DELETE and delete message body |
|
public |
createExecuteMessageRequest(from: URL.URL, to-: URL.URLList, method: string, params: Array): * Creates a Message of type EXECUTE |
|
public |
createForwardMessageRequest(from: URL.URL, to-: URL.URLList, message: *): Message.Message Creates a Message of TYPE FORWARD and Forward Message Body, which contains the message to be forwarded |
|
public |
createMessageResponse(message: *, code: *, value: *, source: *): * Creates the response to the Message |
|
public |
createReadMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URl, attribute: *): Message.Message Creates a Message of type READ |
|
public |
createSubscribeMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URL): * Creates a Message of type SUBSCRIBE |
|
public |
createUnsubscribeMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URL): * Creates a Message of type UNSUBSCRIBE |
|
public |
createUpdateMessageRequest(from: URL.URL, value: *, resource: URL.URL, attribute: *): Message.Message Creates an Update Message Request |
|
public |
generateMessageResponse(data: Message, code: ResponseCode, value: String): * Generate a response to the given Message Request - Response transactions A Response to a Request message should follow this rule: Response.from = Request.to Response.to = Request.from Response.id = Request.id It should be note, the Request.id MUST be incremented every time a new Request message is created. |
Public Constructors
Public Members
public myGenerator: * source
Public Methods
public createCreateMessageRequest(from: URL.URL, to-: URL.URLList, value: String, policy: URL.URL): * source
Creates a Message of TYPE CREATE and Create Message Body
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to- | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
value | String | Contains the created object in JSON format |
|
policy | URL.URL | the sender of this message |
Return:
* |
public createDeleteMessageRequest(from: URL.URL, to: URL.URLList, resource: URL.URl, attribute: *): Message.Message source
Create Delete Message of Type DELETE and delete message body
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
resource | URL.URl | URL of Data Object Resource associated with the message |
|
attribute | * | Identifies the attribute in the Object to be deleted |
Return:
Message.Message | Message - the Delete Message Request |
public createExecuteMessageRequest(from: URL.URL, to-: URL.URLList, method: string, params: Array): * source
Creates a Message of type EXECUTE
Return:
* |
public createForwardMessageRequest(from: URL.URL, to-: URL.URLList, message: *): Message.Message source
Creates a Message of TYPE FORWARD and Forward Message Body, which contains the message to be forwarded
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to- | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
message | * | {Message.Message} message - the message to be forwarded |
Return:
Message.Message | Message - the Forward Message Request |
public createMessageResponse(message: *, code: *, value: *, source: *): * source
Creates the response to the Message
Params:
Name | Type | Attribute | Description |
message | * | the message request from which the response should be generated |
|
code | * | the response code compliant with HTTP response codes (RFC7231). |
|
value | * | contains a data value in JSON format. Applicable to Responses to READ MessageType. |
|
source | * | Contains the original creator of the response. Useful to identify the real source of the response to a one-to-many message delivery ie multiple responses coming coming from different sources. |
Return:
* |
public createReadMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URl, attribute: *): Message.Message source
Creates a Message of type READ
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to- | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
resource | URL.URl | URL of Data Object Resource associated with the message |
|
attribute | * | Identifies the attribute in the Object to be read |
Return:
Message.Message | Message - the Read message request |
public createSubscribeMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URL): * source
Creates a Message of type SUBSCRIBE
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to- | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
resource | URL.URL | URL of the object |
Return:
* |
public createUnsubscribeMessageRequest(from: URL.URL, to-: URL.URLList, resource: URL.URL): * source
Creates a Message of type UNSUBSCRIBE
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
to- | URL.URLList | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
resource | URL.URL | URL of the object |
Return:
* |
public createUpdateMessageRequest(from: URL.URL, value: *, resource: URL.URL, attribute: *): Message.Message source
Creates an Update Message Request
Params:
Name | Type | Attribute | Description |
from | URL.URL | the sender of this message |
|
{URL.URLList}to | * | One or more URLs of Message recipients. According to the URL scheme it may be handled in different ways |
|
value | * | The new value of the attribute to be updated |
|
resource | URL.URL | URL of Data Object Resource associated with the message |
|
attribute | * | Identifies the attribute in the Object to be updated |
Return:
Message.Message | Message - the Update message request |
public generateMessageResponse(data: Message, code: ResponseCode, value: String): * source
Generate a response to the given Message Request - Response transactions A Response to a Request message should follow this rule: Response.from = Request.to Response.to = Request.from Response.id = Request.id It should be note, the Request.id MUST be incremented every time a new Request message is created.
Return:
* |