Skip to content

Instantly share code, notes, and snippets.

@prichelle
prichelle / gist:2b172867313ca0ac1a41
Created January 26, 2015 16:52
ESQL to prepare mail with attachments from broker events
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
/*
emailoutput node requires the following (with attachments):
- LocalEnvironment->Destination->Email->Attachment
-- Attachment -> Content (BLOB)/ContentType (CHAR)/ContentName(CHAR)/ContentEncoding (CHAR)
- Root -> EmailOutput -> Subject (if you would like to be overriden at runtime
- Root -> BLOB (this is the actual body of the mail
*/
@prichelle
prichelle / gist:80978fe4103fadb9f310
Last active August 29, 2015 14:14
inline XML parsing from BLOB using ESQL
-- input of this sample is a XML message <XmlCollection><Collection>3c586d6c436f6c6c65637</Collection></XmlCollection>
-- Collection is a XML data in hexadecimal (BLOB) representation
--Create an element of type parser
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';
-- Create the root tag element of your output XML
CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'RootTag';
DECLARE ptrCollection REFERENCE TO InputRoot.XMLNSC.XmlCollection.Collection;
WHILE LASTMOVE(ptrCollection) DO
@prichelle
prichelle / gist:3edb6373a4995ada4f6d
Last active November 5, 2019 10:12
Tree (ExceptionList) serialization (BLOB) in LocalEnvironment using ESQL ASBITSTREAM FUNCTION
-- Create a folder "ExceptionList" in the LocalEnvironment tree. This Folder will hold the BLOB representation of the ExceptionList
SET OutputLocalEnvironment.Variables.BitStream.Info = 'exceptionList';
-- Define a XML parser element to be used to serialize the ExceptionList into bitstream
CREATE LASTCHILD OF OutputLocalEnvironment.Variables.BitStream DOMAIN('XMLNSC') NAME 'XMLNSC';
-- Attach or create the tree that has to be serialized under the XML parser element. here it is the ExceptionList
SET OutputLocalEnvironment.Variables.BitStream.XMLNSC.ExceptionList = InputExceptionList;
-- Create the BLOB representation of the ExceptinList using the function ASBITSTREAM
SET OutputLocalEnvironment.Variables.BitStream.BLOB =
ASBITSTREAM(OutputLocalEnvironment.Variables.BitStream.XMLNSC.ExceptionList OPTIONS FolderBitStream);