Day 2 Schedule Installation Message Formats Copy in an XML schema MDL editor Create a variable...

Post on 14-Dec-2015

215 views 1 download

Tags:

Transcript of Day 2 Schedule Installation Message Formats Copy in an XML schema MDL editor Create a variable...

Day 2 Schedule

Installation Message Formats

Copy in an XML schema

MDL editor Create a variable

record layout Format tester HL7 Editor X12 Editor

Scheduler Holiday schedules

Lookup Tables

Translation Mappings Create a new map Map editor Operations Map tester Filters User Operation

Script Overview WSDL Import Wizard Component Flow Editor

Overview of features Understanding

Message Flow Running the SA Administration Console

Installation

Prerequisite: Sun Java 1.5 JDK Run installer, install to your choice of location Reboot to allow environment variable changes to take

effect For major versions, if installing to the same location,

uninstall previous version before installing new version Copy in modified ChainBuilderESB-SE-Transformer-

1.2.jar

Installed Components

ChainBuilder ESB Eclipse IDE (IDE + Server install only) Service Mix JBI Container Tomcat Web Server Derby database

Message Formats

HL7 – Healthcare HL7 Editor

MDL – Message Definition Language Message Format Editor Fixed Variable Hierarchical

X12 X12 Editor

XML – import schema

Simple Fixed Record Example – Account Balance

Input Format: Account Number (5), Balance (10) Sample Data (accountBalance.txt):

617230000070.00 514290000238.31 012840007452.99 831490000002.35

File

Message

Fields

Message Type

Field Definitions

Field Attributes

Test the MDL

Test Dir: C:\<cbesb_home>\ideworkspace\Level1\src\test

Move through different lines of sample data

Input Data format: first, last, account# Sample Data (clientAccountNumbers.csv):

Doe,John,61723 Doe,Jane,51429 Smith,John,01284 Johnson,Jim,83149

Simple CSV Example – clientAccountNumbers.mdl

File

Message

Fields

Message TypeDelimiter

Test the MDL

Move through different lines of sample data

HL7 Editor

Many common HL7 formats are pre-loaded HL7 Variants allow for modifications to existing formats

HL7 Editor – Creating a Variant

Add an PID extra field to capture patient email address

MSH|^~\&|ADT1|MCM|LABADT|MCM|199008181126|SECURITY|ADT^A01|MSG00001|P|2.3.1|

EVN|A01|199008181123||

PID|1||PATID1234^5^M11^ADT1^MR^MCM~123-45-6789^^^USSSA^SS||SMITH^JOHN^A^III||19800101|M||C|100 N MAIN STREET^^COLUMBUS^OH^43125-1020|GL|(614)555-1212|(614)555-3434||S||PATID12345001^2^M10^ADT1^AN^A|123456789|987654^OH|||||||||||patient@patient.com

NK1|1|SMITH^JANE^K|WI^WIFE||||NK^NEXT OF KIN

PV1|1|I|2000^2012^01||||004444^SMITH^CHARLES^J.|||SUR||||ADM|A0|

HL7 Editor – Creating a Variant

Add an extra field to the end of the PID with Max Length of 50

HL7 Editor – Testing the Variant

Select message Type ADT A01 and run the test

X12 Editor

Many common X12 formats are pre-loaded X12 Variants allow for modifications to existing formats

Lookup Table Editor

Create from Package Explorer (right click) New -> Lookup File

Simple key-value pair table Click green plus to add new entry

Lookup Tables XML file Named *.tbl Located in tables dir Reference from Transform or Java Example:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE properties SYSTEM

"http://java.sun.com/dtd/properties.dtd"><properties>

<comment>LookUp Table Example general_sample</comment><entry key=“key1">value1</entry><entry key=“key2">value2</entry>

</properties>

Map Editor

Operations Properties Source and Target Trees Operations Tree Operation Palette

Operations

Combine: concatenate multiple sources Comment Block Comment: comment out/uncomment existing

operations Copy: single source to single target Iterate: looping for repeating elements in data Lookup Math

Operations

Send: create outbound message (all in same exchange) Suppress: prevent automatic creation of message at end

of map If: use java comparators, ex ?1.equals(“string”) ElseIf Else While User: use a custom map user operation JDBC: access database during map execution

Map Tester

Must Build the project before testing Click test button to start Select input file Select Read format

Map Tester Results

Source and Target trees with data Operation Tree Flip through multiple results

Save results to file

Map Example with Iterate

Goal: Create map orders.trn which translates from xml format with repeating item elements to similar format

Source: SingleOrderReportInternational.xsd Target: SingleOrderReportUSA.xsd

Map Example with Iterate

Use Automap feature to complete most of the map

Click and Drag from Order (Source Tree) to Order (Target Tree)

Automatically creates copy and iterate statements for all fields with identical names

Map Example with Iterate

Note color coding of elements and parentage groups

Indicates that certain fields were not mapped and may need to be manually mapped

PostalCode -> Zip

Map Example with Iterate

Fill in the missing Zip Code COPY operations

Click on a copy not in the iterate (so that the new operations will not be created inside the iterate)

Drag from source field to target

Map Example with Iterate

Test the map First, save the map and build the project Test files

Order_International_USA_apoproval.xml Order_International_USA_denial.xml

Note how the iteration has populated repeating elements in the outbound message

Map Example with Iterate

Advanced Iterate Example

Goal: map from xml format with repeating product attributes to csv format that includes one attribute

Create one outbound message (all in a single message exchange) from each iteration, and possible create additional outbound messages based on logic

Advanced Iterate Example

The iterate operation executes only on a single looping structure. If we were mapping to a looping structure on our target format, there would be a nested iterate inside this one

Advanced Iterate Example

Lookup table uses the Source as the key and returns the value in the Target field

Advanced Iterate Example

If statement uses java comparators (select type) Reference source data elements with ?1, ?2, ?3, etc

Advanced Iterate Example

IF statement with multiple Source fields using Integer compares

Advanced Iterate Example

Math operation allows for multiple Source fields

Uses ?1 type references Allows for basic mathematical

operations

Advanced Iterate Example

Conditionally populate variables based on attribute name

Create outbound message for each iteration

If we have found height, width, and length then calculate total dimensions and create an additional record

Suppress the automatically created message (to prevent duplication of the last message)

Locate attribute ID in lookup table

Initialize variables

Loop over repeating attribute tags

Custom Code

Code can be written in Java or Groovy Code shells automatically generated Must Build project

Custom Code Types

Map Filter: single method for string manipulation in map Map User Operation: custom map operation TrxId: determination of route name in CBR Upoc: plug into binding component Script Component: custom binding component, can be

provider or consumer Custom Component: create custom binding component

with wizard screens

Filters

Available on many operations Typically used for text manipulation Select Class and Method Must Build project first Single String input Single String output

Map Filter Examplesimport java.util.Date;import java.text.DateFormat;import java.text.SimpleDateFormat;

public class Filters {public String trimQuotes (String in) {

// removes all double-quote characters (") from input datain = in.replaceAll("\"", "");return in;

}

public String replaceSpacesWithUnderscores (String in) {// removes all double-quote characters (") from input datain = in.replaceAll(" ", "_");return in;

}

public String getDateTime(String in) {DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

Date date = new Date();return dateFormat.format(date);

}}

Map User Operation Examplepackage com.bostechcorp.cbesb.map; import java.util.Map;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Map;import com.bostechcorp.cbesb.runtime.ccsl.lib.ITransformationOperation;public class reformatDate implements ITransformationOperation { public boolean process(String[] arg0, String[] arg1) throws Exception { /* * Takes in a date with a given format at outputs the date in a modified format * input: arg0[0]: input date format arg0[1]: output date format arg0[2]: date to be modified * output: arg1[0]: modified date */ String inputPattern = arg0[0]; String outputPattern = arg0[1]; SimpleDateFormat inputFormatter = new SimpleDateFormat(inputPattern); SimpleDateFormat outputFormatter = new SimpleDateFormat(outputPattern); Date date = (Date)inputFormatter.parse(arg0[2]); String dateStr = outputFormatter.format(date); arg1[0] = dateStr; return true; } }

Script Component Examplepublic void run(Log logger, String rootDir, ComponentContext componentContext, DeliveryChannel

channel, MessageExchange exchange, Map<String, String> params) throws Exception {

/* * This class receives in an inbound message and prints the contents * Then the out message is set to a different value and sent on * Use this class when it is necessary to have an out message (in-out) */

NormalizedMessage inMsg = exchange.getMessage("in");NormalizedMessageHandler nmhIn = new NormalizedMessageHandler(inMsg);Source record = nmhIn.getRecordAtIndex(0);// assumes that incoming message is a stringString inMessage = ((StringSource)record).getText();logger.info("modifyMessage - inbound message: " + inMessage);NormalizedMessage outMsg = exchange.getMessage("out");NormalizedMessageHandler nmh = new NormalizedMessageHandler(outMsg);// set new outbound messageStringSource strSrc = new StringSource("modified message");nmh.addRecord(strSrc);nmh.generateMessageContent();LinkedList sendList = new LinkedList();sendList.add(exchange);

}

WSDL Import Wizard

Access from ChainBuilder ESB menu Generates a schema from a WSDL Select source WSDL (must be from a file) and

destination directory Used to create a schema that can be utilized in a map

for sending data to a web service

Component Flow Editor

Eclipse Plug-in Graphical

Interface Drag and drop

functionality Wizard

Assistance

Binding Components

HTTP – includes web services File FTP JMS - MQ TCPIP – Server or Client mode, includes

MLP Script Custom Email – POP3 and SMTP

File Binding Component

Read and or Write files Select Mode Read, Write, or both with check boxes

Use CCSL option turns on or off the CCSL configuration screen later in the wizard. Typically leave this to true.

File Binding Component

File Pattern – for selecting which input files to read from source directory

Glob or Regex Basic or advanced

schedule

Source and Stage directories can be full path or relative (esbHome\runtimes\test\SA)

File Binding Component

Read Style Raw: entire file contents read into single message Newline: each line read into different message within

a single exchange

File Binding Component

Action: delete or archive Hold: How to handle

files in stage directory at startup

Two Pass: whether to check file size twice before reading

File Binding Component

Reply settings Configured for in-

out reader only Reply is the final

out message Write Style

Raw: each message of exchange written to separate file

Newline: all messages of exchange into single file

File Binding Component

File Pattern – contains literal characters and macros BASENAME: original file name (without extension) DATE: system date formatted as yyyymmdd TIME: system time formatted as hhmmss COUNT: automatically incremented value, starts at 1

each time the component is started EXT: original file extension

File Binding Component

Write Mode Properties Only available if Write was checked on the first screen

File Binding Component

CCSL Configuration – allows use of UPoCs (scripting) in the component.

Save Errors: turns on or off the Error Database for errors occurring within this component (leave set to true)

HTTP Binding Component

HTTP SOAP Web Services Client, Server, or both

HTTP Binding Component – Client properties

Enable SOAP for Web services

Browse to select the WSDL

Select proper Service, Port, etc

HTTP Binding Component – Server properties

Enable SOAP for Web services

Define the URL Click on the radio

buttons to open dialog boxes

HTTP Binding Component – Server properties

Use an Existing WSDL dialog box

HTTP Binding Component – Server properties

Create a New WSDL option Creates a WSDL from imported schemas Select a schema to import

HTTP Binding Component – Server properties

Create a New WSDL Option (second page) Configure the options and add the operation

FTP Binding Component – Base Mode

Base mode Send in a message that will be written to ftp or

automatically download from an ftp server into a message

In most cases, script mode is preferable

FTP Binding Component – Script Mode No configuration in component flow All configuration is done through XML message passed to the component Example script:<ftp_request xmlns="http://cbesb.bostechcorp.com/wsdl/ftp/1.0">

<commands><connect host="support.bostechcorp.com" /><login user="supportftpuser" password="Bostech41" /><changeWorkingDir>UPLOAD/ESBtest/source/</

changeWorkingDir><changeLocalWorkingDir>C:\ESBtest\fileout</

changeLocalWorkingDir><mget>*</mget><logout /><disconnect />

</commands></ftp_request>

JMS Binding Component

Use with IBM MQSeries or built-in activeMQ For activeMQ, use the dynamicQueues Name prefix Consumer for gets Provider for puts

TCPIP Binding Component

Select an appropriate handler

Set Mode/Role to Client/Provider if

sending data Server/Consumer if

receiving data

TCPIP Binding Component

Client and Server modes each have different property screens

Script Binding Component

Select a script (Java or Groovy) from either the SA or ESB project

Consumer mode allows for configuration of schedule

Custom Binding Component

Select from a list of available custom binding components

Custom components are created as separate projects outside of any SA or ESB project

Select the proper component which then makes the configured wizard screen available

Email Binding Component

Send messages using SMTP

Email Binding Component

Retrieve messages through POP3

Service Engines

Transformer Parser XSLT Sequencer CBR JDBC

Transformer Service Engine

Configure with a predefined .trn transform file Send in original message, mapped message will be

returned

Parser Service Engine

Shows CBESB internal XML representation of message Useful to quickly create an XML version of any data Select Parser Type from mdl, X12, or HL7 Select a Message Definition from the selected type

XSLT Service Engine

Configure with a predefined XSLT file Send in original message, modified message will be

returned

Sequencer Service Engine

Used to order the flow of a message through multiple events

As MessageExchanges are created, the will automatically be numbered sequentially

CBR Service Engine

Content Based Router Routes messages based on message content Available Route types:

Fixed CSV – any delimiter HL7 X12 XPath – XML routing Script

JDBC Service Engine

Used for database connectivity Send in an XML message which includes SQL statement

Other Components

External External System – Used to indicate

what external system is used Comment

Message Flows Message Exchange – connects

components in the flow

Scheduler

Scheduling is built into many Binding Components

Works like Cron Fill in specific values or

* for any value ? For no value (used to

prevent Day of Monty/Day of Week conflict)

This example would run every hour on the hour

Optionally select a Holiday schedule

Holiday Schedules

Define exceptions to the schedule Schedule will not run on days defined in the holiday

schedule Create from Package Explorer (right-click) New ->

Holiday File Click green plus to add a date

Understanding Message Flow

Role Consumer – Accepts an inbound message (reads a

file, etc) and starts a message flowing through the engine

Provider – Sends a message to an outside system (writes a file, etc) and marks the end of the message path in CBESB

MEP – Message Exchange Pattern In-only: Creates a message and does not expect a

return In-out: Creates a message and expects a return

message Reliablein: In-Only with fault handling

In-Only

FileIn Properties:

In-Out

Understanding Message Flow

Each component acts as either In-Out or In-Only Depends on location within flow Children of a Sequencer are always in-out except for

the last item which takes the input MEP Arrow changes from normal (in-only) to diamond end (in-out)

Children of a CBR take the input MEP

Message Flow Example with SequencerIn-Only file component reader

In-Out file component reader

Note changes in message exchange arrows

In-Only In-Out

Running the Service Assembly – Command Line

cbesb_run <sa_name> Must be executed from the drive where ESB is installed Debug mode: cbesb_run –debug <sa_name> If using activeMQ: cbesb_run –activemq <sa-name> Logging information stored <cbesb_home>\runtimes\log

Running the Service Assembly – Admin Tool

Connect to local or remote machine http://<server>:8080/console/ For local machine: http://localhost:8080/console/ Logging information viewable in console or stored on file

system: <cbesb_home>\log

Running the Service Assembly – Admin Tool Initial Setup

First time using the console, install and start all binding components and service engines

On the Install tab, Click Install to install each component

Running the Service Assembly – Admin Tool Initial Setup

On the Current Tab, click Start to start each component

Running the Service Assembly – Admin Tool

Deploying the Service Assembly Click Assemblies, then the Deployment tab Browse to the directory <cbesb_home>\ideworkspace\

<sa_name>\dist Select the zip file Click Submit then Deploy

Running the Service Assembly – Admin Tool

On the Current tab, click Start to start the Service Assembly

Day 2 Review

Installation Message Formats

Copy in an XML schema

MDL editor Create a variable

record layout Format tester HL7 Editor X12 Editor

Scheduler Holiday schedules

Lookup Tables

Translation Mappings Create a new map Map editor Operations Map tester Filters User Operation

Script Overview WSDL Import Wizard Component Flow Editor

Overview of features Understanding

Message Flow Running the SA Administration Console