Message

Purpose

XML Business Message Manipulation and Processing.

Methods

Binding name: message

Note

MI stands for ‘MessageInfo’ and is the most commonly used business message manipulated by Platform 6. For backward compatibility a MessageInfo message has a dataClusterName: B2BOX and concept: MessageInfo

  • ItemPK buildPK(String dataClusterName, String concept, String… itemIds): Build an message item primary key (ItemPK) from it’s constituent parts
  • ItemPK buildMIPK(String… itemIds): Build a message item primary key (ItemPK) for a MessageInfo (MI) using supplied itemIds
  • String getSerialForm(ItemPK pk): Use JAXB to serialize the POJO item containing the business message using the supplied item primary key
  • String get(ItemPK pk): Get the XML message as a String using the supplied item primary key.
  • String exists(ItemPK pk): Return the XML message as a String using the supplied item primary key or null if not found
  • String remove(ItemPK pk): Remove the XML message and return it’s content as a String using the supplied item primary key or null if not found
  • ItemPK put(String xml, ItemPK pk): Stores the supplied XML message using the supplied item primary key
  • ItemPK putMI(String xml, String… ids): Stores the supplied XML as a MessageInfo (MI) using supplied itemIds
  • ItemPK projectMI(String xml, String… ids): Projects the supplied XML (validates against a data model and stores) as a MessageInfo (MI) using supplied itemIds
  • ItemPK project(String xml, String dataModelName, ItemPK pk): Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key
  • ItemPK projectAndRouteMI(String xml, String… ids): Projects the supplied XML as a MessageInfo (MI) using supplied itemIds and notifies the b2box routing engine to route the message
  • ItemPK p6projectAndRouteMI(String xml, String endpointUrl, String… ids): Projects the supplied XML as a MessageInfo (MI) using supplied itemIds and sends as a camel Exchange to the given platform6 routing endpoint.
  • ItemPK projectAndRoute(String xml, String dataModelName, ItemPK pk): Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key and notifies the b2box routing engine to route the message
  • ItemPK p6projectAndRoute(String xml, String dataModelName, ItemPK pk, String endpointUrl): Projects the supplied XML (using the supplied data model for content validation) using the supplied item primary key and sends as a camel Exchange to the given platform6 routing endpoint.
  • ItemPK route(ItemPK pk): Notifies the b2box routing engine to route the message using the supplied item primary key
  • ItemPK p6route(ItemPK pk, String endpointUrl): Sends the supplied item primary key as a camel Exchange to the given platform6 routing endpoint.
  • boolean validate(String xml, String schemaUri): Validate the supplied XML against the schema found at the supplied URI

Examples

def ipk = message.buildPK('B2BOX', 'MessageInfo', '123', '456')
println ipk

ipk = message.buildMIPK('Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210')
println ipk

def serialBean = message.getSerialForm( ipk )
println serialBean

def miXml = message.get(ipk)
println miXml

def xml = message.exists(ipk)
println xml

ipk = message.buildMIPK('Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy')
xml = message.exists(ipk)
println xml

ipk = message.put('<xml></xml>', ipk)
println ipk

ipk = message.remove(ipk)
println ipk

ipk = message.putMI('<xml></xml>', 'Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy')
println ipk

ipk = message.projectMI(miXml, 'Invoice_FTP-000464_9777cdd0-70d6-46d5-a130-1498222529210-copy')
println ipk

ipk = message.project(miXml, 'MessageInfo', ipk)
println ipk

ipk = message.projectAndRoute(miXml, 'MessageInfo', ipk)
println ipk

def valid = message.validate(miXml, 'file://${b2box.data}/resources/schemas/pidx_v1_0/PIDX-Invoice-2002-02-14-V1-0.xsd')
println valid