Curam Developer customizatinon - Web service/ REST , additional processing
Outbound Web Services
-An outbound webservice connector allows Curam SPM applications to access external applications that have exposed a web service interface -A client stub (wrapper) is generated from the WSDL file that describes the interface -Developers implement business logic in a client class (consumer) *the consumer connects to the web service by using the stub *The consumer handles the data that is returned from the web service
Running Batch Jobs
-Batch Jobs are run from the command line directly or via a scheduled script -all ordered jobs can be run in the defined sequence: (build runbatch) -Specific jobs can be executed by using program.name: Dprogram.name=curam.custom.sl
Batch Processing Overview
-Batch jobs are Java applications that run outside the application server -Curam SPM provides several batch jobs OOTB which can be customized -Developers can define custom batch jobs also -Batch jobs can be scheduled by using any industry standard scheduler -The batch launcher starts the batch jobs
Batch Classes
-Chunker class -Stream class -wrappers are required to implement the batch iterfaces -chunker wrapper -stream wrapper
Developing REST API
-Curam provides REST APIs ootb *developers can use provided REST APIs but CANNOT customize them *however developers can develop their own APIs
Add deferred process to the DPProcess Table
-Deferred processes must be defined in the DPProcess table (the entry associates the process name with its implementation) -Load the process from a DMX file
Developers can perform the following tasks for EVX
-Define custom listeners to add custom code for OOTB events -Define custom events, listeners, and raise events
Streaming configuration
-Define properties for the batch job in application.prx in your custom component -Review the properties in line with changes to the associated dataset -The OOTB application.prx file cotains global properties for wait intervals and batch tracing
Defining Events and Event Handlers
-Define the event in an EVX file -Define event handlers and filters in handler_config.xml -build evgen then build database -write code to raise event -write code for the event filter and event handler
curam provides the following elements to support deferred processing
-Enactment service engine -deferred processing tables -deferred processing queues, which are implemented in the application server or by using JMS lite in a dev environment
Error handling can be configured in two ways:
-Global error handler callback -error handling for a specific deferred process
Curam provides the following support for web services
-Inbound and outbound web services ootb -Course-grained business services for all major functional areas can be exposed as web services -Tools for developing inbound and outbound web services -support for WS standards required by WS-I basic Protocol and WS-Security -Built on Apache Axis2
Inbound Web services
-Inbound web services exposes the functionality within the Curam SPM application to other internal or external applications within the network. -Developers write business logic for the web service -Infrastructure generates necessary deployment artifacts and packages them for redeployment -Once deployed, any external party that wishes to communicate with the Curam SPM application will have to implement the appropriate client functionality
Steps for building outbound web services using Axis2
-Include the WSDL file in our components file system (add to EJBServer\compnents\custom\axis -Add to the location of the WSDL file to ws_outbound.xml -generate the web service stubs from the WSDL file (build wsconnector2) -Create a client(consumer) and invoke the web service (client uses generated stubs) -test
Curam provides two mechanisms for implementing events
-Persistence Infastructure events -Event (EVX) files
running batch jobs- reporting
-The batch job returns an error code and typically a report -An email is sent to the recipient who is configured by curam.batchlauncher.erroremail.recipient -The email server is identified by: curam.mail.smtp.serverhost -check the BatchLauncher<Date_Time>.log file for errors
Chunking and Streaming Operation
-The chunker separates the data into chunks and hands control to the Batch Stream Helper -The batch Stream Helper then passes chunks of data to streams -Once each Stream completes, control returns to the chunker to finish the job
Batch streaming architecture
-You can run multiple instances of streams of the same batch process to process chunks of records on different processors -The chunk size and stream commit size are configurable -Each chunk is processed in a separate database transaction, which provides commit-point processing -Ensure that no dependencies exist between chunks
Batch Processing overview cont
-catching and streaming can be used to improve batch performance -Curam provides support for deferred processing and starting workflows from within batch jobs
process for developing REST APIs
-design the API -model and document the API in RSAD -Implement the REST facade for the API configure the API test
Deferred processes
-executed asynchronously -Curam uses deferred processes for time consuming tasks that are invoked online such as: Authorizing programs, approving cases, and checking eligibility
Developing a batch job
-model batch(chunk) job and streaming job -add an entry to the BatchProcessName code table -Define streaming properties in Application.prx -Code the batch(chunk) job class and wrapper -Code the streaming job class and wrapper -test -Configure an ant task and job administration
Developing a deferred process steps
-model the deferred process -implement the deferred process -add the deferred process to the DPProcess table -write code to enact the deferred process -test and troubleshoot
defining Inbound web services
-model the inbound web service (model the class as wsinbound and add operations -build the server application as normal (generates WSDL, stub, and other outputs) -implement the business logic for the server -build the web services EAR file and install in the app server -provide security information for the service
Event Handling implements the Observer pattern
-the observers or listeners register to receive events from the subject -The subject simply raises an event to inform its observers -the subject requires no knowledge of the observers' intentions
references
-web services reference guide -Integrating curam rest API -Developing curam rest API guide -IBM curam REST API accelerator
Implementing the Facade for API
1. Determine the requirements for the REST facade operations perform fit-gap analysis to determine the Curam APIs to manage the resources like DynamicEvidence API 2. Write and test the REST facade 3. Configure the API (create ResourcesConfig.xml in components\custom\rest\config to map the resoure paths to the REST facade operations) 4. build rest -Denable.validations=true build and deploys to Tomcat -view the API 5.Test and troubleshoot API
model and document API
1. Model domain definitions and structs -model the JSON representation of the resource as structs -model structs for operation parameters 2.Model a REST facade to implement the operations -model the facade with <rest> stereotype -define a method for each CRUD operation 3.Specify mandatory fields 4.document the API 5. perform build generated and build database
Batch processing operation
1. The administrator selects the batch jobs to execute and the order to execute them 2.Execute jobs -an external scheduler calls the 'runbatch' ant target via a script -the ant target calls the batch launcher, which executes the batch jobs 3. Inform the operator when completed (can email log an errors to a nominated user)
steps for designing the API
1. perform fit-gap analysis to determine whether provided Curam REST APIs can fulfill the requirements 2. Determine the resources for the API by considering the business objects and granularity 3. determine the methods or operations for the API 4Specify the structure of the resource in JSON format
when a deferred process fails to complete successfully
1. retry for the maximum redelivery attempts that are configured 2. if it still fails, add an item to the DPError queue 3. invoke the callback handler to notify the client and take some action
batch job rules
Batch job can have many methods -There can only be ONE operation in a process class that uses <batch> stereotype -The operation can take only one parameter, which can be <struct> -The struct parameter must be flat, in other words, it must not aggregate any other structs -The operation return type should be void, Non-void return types are ignored ,that is, reates as void
REST cont.
Clients and servers exchange representations of resources in self descriptive messages over HTTP
REST APIs provide CRUD operations for resources
Create (POST) Read(GET) Update(PUT) Delete(DELETE) -resources can be described in JavaScript Object Notation (JSON)
Web services
Curam SPM applications use web services to integrate with external systems for payments, case processing, address validation, identity intelligence etc
Supported WSDL style use models
Curam w Axis2: RCP/literal, Document/literal Curam w Axis1.4: RCP/encoded, document/literal
Define Event Handlers and Filters
Define the event handler and filter in handler_config.xml: -Define in EJBServer\components\<component>\events -handler_config.xml files are merged based on component order -Specify the fully qualified name of the handler and filter -List the event classes for which the handler is registered
Defining an Event- EVX file
EVX files are stored in the events subdirectory of the component, for ex: EJBServer/components/core/events/Person.evx
Event Attributes
Event objects consist of the following attributes: -Event Class -Event Type -Primary Data -Secondary Data
Supported processing types in Curam
Online Deferred Timed Event Based Workflow Batch
Packaging
SOAP is an XML based protocol that enables the packaging of web service requests and responses. SOAP uses an envelope construct to specify what is in a message, who should deal with it, and whether it is optional or mandatory
Discovery
UDDI was intended as the discovery protocol so that web services can publish their location and description centrally so that they are easier to discover. However DDI is not commonly used and is not appropriate for government agencies
Web services technologies and standards
UDDI- Registry for finding services WSDL- The location and purpose of service SOAP- A protocol to transfer messages HTTP- the most common transport layer
Raising Events - code
Use the raiseEvent method of the EventService class (you must set the event class, event type, and event match data)
Description
WSDL is an XML based language that describes what the web service does and where to find it. The WSDL for a web service provides everything a requesting program needs to use the service
Swagger
a specification for documenting REST APIs using JSON -curam generates swagger documentation -Tools allow developers to access swagger documentation: *Discover APIs and view documentation *Run APIs to test operations
REST
an architectural principle to 'manipulate representations of Web resources using a uniform set of stateless operations'
Event handler builds
build evgen generates: -A java class to allow you to access the event in your code, which is generated to EJBServer\build\svr\events\gen\package -DMX files to load the event definitions into the database, which are generated to EJBServer\build\svr\events\gen\package Refresh Eclipse to compile generated class Build database (to load DMX files into EventClass and EventType tables)
implement error handling
curam.util.deferredprocessing.impl.DPCallback.dpHandleError -set the property for the name of the handler
Model the Deferred process
model <wmdpactivity> for BPO -Specify parameters for the following attributes: *ticketID(long): Ticket ID of the DPTicket record generated by DP Engine *inst_data_id(long): Instance ID of the WMInstanceData record *flag(boolean): Used by the DP infrastructure
transport
web service requests that are encoded via SOAP are independent of any operating system or transport protocol and can be transported by several internet protocols, such as JMS, SMTP, MIME , and HTTP