ProcessSVCEmails and ProcessSingleSVCEmail
Contents
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.
The request service can be:
- A PDF report
- An Excel report
- A BIRT report
containing data about persons and credit cards.
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 adapters and plugins needed.
When a service requires the generation of a BIRT report, it is necessary to configure the GVDataHandlerConfiguration and GVBIRTReportConfiguration Adapters. To do that, go to the VulCon® Adapter view.
GVAdapters Configuration
GVDataHandlerConfiguration
Inside of element GVDataHandlerConfiguration insert a new DBOBuilder and set its attributes as:
- jdbc-connection-name="ds.gv_test"
- name="ListPersons"
Insert, into ListPersons a new item DBOSelect with the property:
- name="ListPersons"
and containing an element statement with:
- id="1"
- type="select"
select ' ', 'NULL' from dual union all select p.NAME, p.NAME from PERSON p order by 1
GVBIRTReportConfiguration
Inside of elements GVBIRTReportConfiguration / ReportGroups, create a new ReportGroup (by right clicking element ReportGroups -> Insert After -> ReportGroup). Name it TestGRP.
Inside of TestGRP, insert a new Report. Set its attributes as:
- config: "CreditCards.rptdesign"
- name: "Credit Cards"
Inside of Report Credit Cards insert an element Parameters containing the item Parameter setted as follow:
- control-type: "SELECT"
- label: "Nome"
- name: "NAME"
Inside of NAME put an element DHSource with the attributes:
- service: "ListPersons"
- sort: "true"
- use-string-map: "true"
Now you might 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:
|
smtp-call | name="SendEmailNoSVC" jndi-name="gvesb.mailServer" mail-message:
|
excel-call | name="listPerson" GVExcelReport:
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
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:
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 |