The Reporting
Service will be one of the framework services within SOA environment. The Reporting
Service will be a generic service which will listen to Reporting queue of OSB, log
or record transaction or exception data, or to raise a notification or alert to
an end user or technical
Support group.
How to build a custom Reporting handler has been
explained in detail in Zoggel’s blog
The options are useful in case you have custom
OSB Reporting Data Handler (Reporting Service) which will be listening to the
OSB JMS Provider QUEUE. OSB will perform reporting using the OSB JMS Provider
QUEUE and message payload will contain ReportData
and ReportMetadata. These variables
can be XML elements or Strings. These will need to be retrieved in the custom
OSB reporting handler and processed further.
I will mention 2 approaches for logging/processing of report
data
1.
You can report all the parameters separately as
key-value pair
The Report Metadata will contain
all the key-value pairs in side labels tag.
<ReportMetadata
= <rep:messagecontext
xmlns:rep="http://www.bea.com/wli/reporting"><rep:content-encoding>iso-8859-1</rep:content-encoding><rep:labels>QUERYSTRING=id=100;PROJECT_NAME=GEOTEST;;MODULE_NAME=HR;SERVICE_NAME=searchById;CORRELATION_ID=sdsadad123213123asdasd;START_TIME;SERVICE_TYPE;HTTP_METHOD</rep:labels><rep:inbound-endpoint
name="ProxyService$GEOGateway$REST$v1$GEORestfulGateway"><rep:service/><rep:transport><rep:uri>/geo_services/GEOBus/GEOGateway/REST/v1/GEORestfulGateway</rep:uri><rep:mode>request-response</rep:mode><rep:qualityOfService>best-effort</rep:qualityOfService></rep:transport></rep:inbound-endpoint><rep:origin><rep:state>REQUEST</rep:state><rep:node>GatewayPipeline</rep:node><rep:pipeline>GatewayPipeline_request</rep:pipeline><rep:stage>CheckRegistryStage</rep:stage></rep:origin><rep:timestamp>2013-05-30T18:19:08.086-07:00</rep:timestamp></rep:messagecontext>>
2.
You will need to write an Xquery to populate the
variable with the REPORT_DATA data structure.
Code snippet of Xquery
declare function xf:PopulateReportData($inbound as
element(*))
as
element(ns0:REPORT_DATA) {
<ns0:REPORT_DATA>
<ns0:PROJECT_NAME>GEO</ns0:PROJECT_NAME>
<ns0:MODULE_NAME>{substring-before(data($inbound/ctx:transport/ctx:request/http:relative-URI),"/")}</ns0:MODULE_NAME>
<ns0:SERVICE_NAME>{substring-after(data($inbound/ctx:transport/ctx:request/http:relative-URI),"/")
}</ns0:SERVICE_NAME>
<ns0:SERVICE_TYPE>REST</ns0:SERVICE_TYPE>
<ns0:HTTP_METHOD>{data($inbound/ctx:transport/ctx:request/http:http-method)}</ns0:HTTP_METHOD>
<ns0:USER_NAME>{xf:GetHttpQueryParameter($inbound/ctx:transport/ctx:request/http:query-string/text(),'geo-username')}</ns0:USER_NAME>
<ns0:USER_ID>{xf:GetHttpQueryParameter($inbound/ctx:transport/ctx:request/http:query-string/text(),'geo-userid')}</ns0:USER_ID>
<ns0:START_TIME>{fn:current-dateTime()}</ns0:START_TIME>
<ns0:SYSTEM_ID>{xf:GetHttpQueryParameter($inbound/ctx:transport/ctx:request/http:query-string/text(),'geo-key-id')}</ns0:SYSTEM_ID>
<ns0:CORRELATION_ID>{fn-bea:uuid()}</ns0:CORRELATION_ID>
<ns0:MSG_ID>{fn-bea:uuid()}</ns0:MSG_ID>
<ns0:QUERYSTRING>{$inbound/ctx:transport/ctx:request/http:query-string/text()
}</ns0:QUERYSTRING>
<ns0:STATUS>REQUEST_RECIEVED</ns0:STATUS>
<ns0:PROCESS_FLOW_STAGE>REQUEST</ns0:PROCESS_FLOW_STAGE>
</ns0:REPORT_DATA>
};
In this case ReportData will contain
the payload in XML format.
Report Data
<head:REPORT_DATA
xmlns:head="http://geo.com/report/header"><head:PROJECT_NAME>GEO</head:PROJECT_NAME><head:MODULE_NAME>Employee</head:MODULE_NAME><head:SERVICE_NAME>RequestEmployeeId</head:SERVICE_NAME><head:SERVICE_TYPE>REST</head:SERVICE_TYPE><head:HTTP_METHOD>GET</head:HTTP_METHOD><head:USER_NAME>george</head:USER_NAME><head:USER_ID>geo123</head:USER_ID><head:START_TIME>2013-05-30T18:19:08.080-07:00</head:START_TIME><head:SYSTEM_ID>DAD</head:SYSTEM_ID><head:CORRELATION_ID>d10e6395-da61-44cf-b004-a4b0360bf965</head:CORRELATION_ID><head:MSG_ID>e52c1b84-4da9-4134-9c5f5ccd7bb8778</head:MSG_ID><head:QUERYSTRING><![CDATA[requesterFirstName=George&requesterLastName=Thomas&requesterEmail=george.Thomas@geo.com&userID=geo]]></head:QUERYSTRING><head:STATUS>SUCCESS</head:STATUS></head:REPORT_DATA>
References :