Transcript

source: www.cx-journey.com

••

••••••

{ "employees": { "employee": [ { "lastName": "Patterson", "salary": 2000, "firstName": "Mary" } ] }}

•–

––

••

@startuml

IntegrationFlow : DISWorkflow

participant inboundendpointListener : InboundEndpoint(protocol("http"),port(8082),context("/disworkflow"))participant pipeline : Pipeline("dis_workflow")participant datasource : OutboundDataSource(protocol("rdbms"),host("jdbc:mysql://localhost:3306/DISTEST"),username("root"),password("root"))

inboundendpointListener -> pipeline : "Request"

log("Before Select")

pipeline -> datasource : query(statement("SELECT * FROM Employee"),resultset(rs))datasource -> pipeline

log("After Select")

pipeline -> inboundendpointListener : "Response"@enduml

@startuml

IntegrationFlow : DISWorkflow

participant inboundListener : InboundEndpoint(protocol("http"),port(8082),context("/disworkflow"))

participant pipeline : Pipeline("dis_workflow")

participant datasource : OutboundDataSource(protocol("rdbms"),host("jdbc:mysql://localhost:3306/DISTEST"),username("root"),password("root"))

inboundListener -> pipeline : "Request"

log("Before Insert")

group transaction

pipeline -> datasource : query(statement("INSERT INTO Location(City,Country) VALUES(?,?)"),parameter($in.City,$in.Country),resultset(rs))

datasource -> pipeline

pipeline -> datasource : query(statement("INSERT INTO Employee(Name,CityID) VALUES(?,?)"),parameter($in.Name,$rs.id))

datasource -> pipeline

else

log("Transaction Error - Rolled back")

end

log("After Insert")

pipeline -> datasource : query(statement("SELECT * FROM Employee"))

datasource -> pipeline

pipeline -> inboundListener : "Response"

@enduml

@startuml

IntegrationFlow : DISWorkflow

participant inboundListener : InboundEndpoint(protocol("http"),port(8082),context("/disworkflow"))

participant pipeline : Pipeline("dis_workflow")

participant datasource : OutboundDataSource(protocol("rdbms"),host("jdbc:mysql://localhost:3306/DISTEST"),username("root"),password("root"))

inboundListener -> pipeline : "Request"

group Transaction

log("Within Transaction")

loop $in.cities

pipeline -> datasource : query(statement("INSERT INTO Location(City, Country) VALUES(?,?)"),parameter($cities.City,$cities.Country),resultset(rs0))

datasource -> pipeline

loop $cities.employees

pipeline -> datasource : query(statement("INSERT INTO Employee(Name,CityID) VALUES(?,?)"),parameter($employees.Name,$rs0.id))

datasource -> pipeline

end

end

else

log("Error Sequence")

end

log("Before Select")

pipeline -> datasource : query(statement("SELECT * FROM Employee"),resultset(rs2))

datasource -> pipeline

log("After Select")

pipeline -> inboundListener : "Response"

@enduml

@startuml

IntegrationFlow : DIS_Insert

participant inboundListener : InboundEndpoint(protocol("http"),port(8080),context("/insertemployee"))participant pipeline : Pipeline("dis_flow")participant datasource1 : OutboundDataSource(protocol("rdbms"),host("jdbc:mysql://localhost:3306/mysqltestdb"),username("root"),password("root"))participant datasource2 : OutboundDataSource(protocol("rdbms"),host("jdbc:oracle:thin:@//localhost:1522/oracletestdb"),username("root"),password("root"))

inboundListener -> pipeline : "Request"

log("Before Insert")

pipeline -> datasource1 : query(statement("INSERT INTO Location(City, Country) VALUES(?,?)"),parameter($in.CityName,$in.Country))datasource1 -> pipeline

pipeline -> datasource2 : query(statement("INSERT INTO Employee(Id, Role) VALUE(?,?)"),parameter($in.Id,$in.Role))datasource2 -> pipeline

log("After Insert")pipeline -> datasource1 : query(statement("SELECT * FROM Location"))datasource1 -> pipeline

pipeline -> inboundListener : "Response"

@enduml

••