Difference between revisions of "ProcessSVCEmails and ProcessSingleSVCEmail"

From GreenVulcano Wiki
Jump to: navigation, search
Line 31: Line 31:
 
: sender-display-name="GV ESB"
 
: sender-display-name="GV ESB"
 
: subject="RE: ${property['SUBJECT']}"
 
: subject="RE: ${property['SUBJECT']}"
: message-body:
+
: '''message-body''':
 
:: gvBuffer-dump="false"
 
:: gvBuffer-dump="false"
 
:: message-text:
 
:: message-text:
 
::: Persons data  
 
::: Persons data  
: attachments
+
: '''attachments''':
 
:: gvBuffer:
 
:: gvBuffer:
::: name="PersonsData_${@it.greenvulcano.util.txt.DateUtils@nowToString('yyyyMMddHHmmss')}.${property['FILE_EXT']}"
+
::: name="PersonsData_${@it.greenvulcano.util.txt.DateUtils@nowToString('yyyyMMddHHmmss')}.
 +
${property['FILE_EXT']}"
 
|-
 
|-
 
| [[smtp-call]] || name="SendEmailNoSVC" <br/>jndi-name="gvesb.mailServer"  <br/>mail-message:  
 
| [[smtp-call]] || name="SendEmailNoSVC" <br/>jndi-name="gvesb.mailServer"  <br/>mail-message:  
Line 44: Line 45:
 
: sender-display-name="GV ESB"
 
: sender-display-name="GV ESB"
 
: subject="RE: ${property['SUBJECT']}"
 
: subject="RE: ${property['SUBJECT']}"
: message-body:
+
: '''message-body''':
 
:: gvBuffer-dump="false"
 
:: gvBuffer-dump="false"
:: message-text:
+
:: '''message-text''':
 
::: Invalid service request. Available Services:
 
::: Invalid service request. Available Services:
 
:::: SVC=LIST_EXCEL[!NAME=.....]
 
:::: SVC=LIST_EXCEL[!NAME=.....]
Line 56: Line 57:
 
: group="CREDIT"
 
: group="CREDIT"
 
: jdbc-connection="ds.gv_test"
 
: jdbc-connection="ds.gv_test"
: Sheet:
+
: '''Sheet''':
 
:: id="1"
 
:: id="1"
 
:: name="Person List"
 
:: name="Person List"
Line 67: Line 68:
 
  <nowiki>decode{{@{{NAME}}::NULL::::and p.NAME='@{{NAME}}'}}</nowiki>
 
  <nowiki>decode{{@{{NAME}}::NULL::::and p.NAME='@{{NAME}}'}}</nowiki>
 
  order by c.NAME, p.NAME
 
  order by c.NAME, p.NAME
: Sheet:
+
: '''Sheet''':
 
:: id="2"
 
:: id="2"
 
:: name="Credit Card List"
 
:: name="Credit Card List"
Line 73: Line 74:
 
:: statement:
 
:: statement:
 
::: type="select"
 
::: type="select"
  select p.NAME as 'Name', cc.CNUMBER as 'Card Number', cc.CREDIT as 'Credit', decode(cc.ENABLED, 'Y', 'Yes', 'No') as 'Active'  
+
  select p.NAME as 'Name', cc.CNUMBER as 'Card Number', cc.CREDIT as 'Credit',
 +
decode(cc.ENABLED, 'Y', 'Yes', 'No') as 'Active'  
 
  from PERSON p, CREDIT_CARD cc
 
  from PERSON p, CREDIT_CARD cc
 
  where p.ID = cc.ID_OWNER
 
  where p.ID = cc.ID_OWNER
Line 84: Line 86:
 
: jdbc-connection-name="ds.gv_test"
 
: jdbc-connection-name="ds.gv_test"
 
: name="UserDataAsPDF"
 
: name="UserDataAsPDF"
: DHVariables:
+
: '''DHVariables''':
 
:: DHVariable name="decimal-separator" value="."
 
:: DHVariable name="decimal-separator" value="."
 
:: DHVariable name="grouping-separator" value=","
 
:: DHVariable name="grouping-separator" value=","
 
:: DHVariable name="format" value="#0.00"
 
:: DHVariable name="format" value="#0.00"
 
:: DHVariable name="NAME" value="NULL"
 
:: DHVariable name="NAME" value="NULL"
: DBOSelect:
+
: '''DBOSelect''':
 
:: name="UserDataAsPDF"
 
:: name="UserDataAsPDF"
 
:: transformation="UserDataAsPDF"
 
:: transformation="UserDataAsPDF"
:: statement:
+
:: '''statement''':
 
::: id="1"
 
::: id="1"
 
::: keys="1,2,3"
 
::: keys="1,2,3"

Revision as of 11:39, 21 February 2012

Description

This example shows how GreenVulcano® ESB receipts and processes emails. The workflow consists in two services: ProcessSVCEmails which receives the messages and for each one calls service ProcessSingleSVCEmail that processes it.

ProcessSVCEmails service executes the following operations:

  • Checks if there are new service messages
  • For each one invokes a processing service

ProcessSingleSVCEmails service executes the following operations:

  • Receives data from an email
  • Reads the subject and verifies if it is well formatted
  • If subject is well formatted invokes the respective service for the request. If don't, sends a preconfigured email.

VulCon Configuration

The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first configure the VCL plugins needed. So let's define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard.

Defining System, Channel and Operations

To define a System, go to VulCon core view and, into Systems element, insert the System CREDIT if it is not already present. From there create the Channel CHANNEL_CREDIT_MAIL in which the following operations will be configured:

Attribute/Subelement Value
pop-call name="ReceiveSVCEmail"
delete-messages="true"
expunge="true"
jndi-name="gvesb.mailServer"
smtp-call name="SendEmailSVCResponse"
jndi-name="gvesb.mailServer"
mail-message:
content-type="text-plain"
high-priority="false"
sender-display-name="GV ESB"
subject="RE: ${property['SUBJECT']}"
message-body:
gvBuffer-dump="false"
message-text:
Persons data
attachments:
gvBuffer:
name="PersonsData_${@it.greenvulcano.util.txt.DateUtils@nowToString('yyyyMMddHHmmss')}.

${property['FILE_EXT']}"

smtp-call name="SendEmailNoSVC"
jndi-name="gvesb.mailServer"
mail-message:
content-type="text-plain"
high-priority="true"
sender-display-name="GV ESB"
subject="RE: ${property['SUBJECT']}"
message-body:
gvBuffer-dump="false"
message-text:
Invalid service request. Available Services:
SVC=LIST_EXCEL[!NAME=.....]
SVC=LIST_PDF[!NAME=.....]
SVC=LIST_BIRT[!TYPE=EXCEL or PDF(default)][!NAME=.....]
excel-call name="listPerson"
GVExcelReport:
format="default"
group="CREDIT"
jdbc-connection="ds.gv_test"
Sheet:
id="1"
name="Person List"
title="Person List - timestamp{{dd/MM/yyyy HH:mm:ss}}"
statement:
type="select"
select p.NAME as 'Name&', p.BIRTHDATE as 'Birth Date', c.NAME as 'City'
from PERSON p, CITY c
where p.ID_CITY = c.ID
decode{{@{{NAME}}::NULL::::and p.NAME='@{{NAME}}'}}
order by c.NAME, p.NAME
Sheet:
id="2"
name="Credit Card List"
title="Credit Card List - timestamp{{dd/MM/yyyy HH:mm:ss}}"
statement:
type="select"
select p.NAME as 'Name', cc.CNUMBER as 'Card Number', cc.CREDIT as 'Credit',
decode(cc.ENABLED, 'Y', 'Yes', 'No') as 'Active' 
from PERSON p, CREDIT_CARD cc
where p.ID = cc.ID_OWNER
decode{{@{{NAME}}::NULL::::and p.NAME='@{{NAME}}'}}
order by p.NAME
birt-report-call groupName="TestGRP"
name="CreditCards"
reportName="Credit Cards"
reportType="excel"
dh-call name="UserDataAsPDF"
DBOBuilder:
jdbc-connection-name="ds.gv_test"
name="UserDataAsPDF"
DHVariables:
DHVariable name="decimal-separator" value="."
DHVariable name="grouping-separator" value=","
DHVariable name="format" value="#0.00"
DHVariable name="NAME" value="NULL"
DBOSelect:
name="UserDataAsPDF"
transformation="UserDataAsPDF"
statement:
id="1"
keys="1,2,3"
type="select"
select p.NAME, p.BIRTHDATE, c.NAME, cc.CNUMBER, cc.CREDIT, cc.ENABLED
from PERSON p, CITY c, CREDIT_CARD cc
where p.ID_CITY = c.ID
and p.ID = cc.ID_OWNER
decode{{@{{NAME}}::NULL::::and p.NAME like '%@{{NAME}}'}}
order by c.NAME, p.NAME</statement>