forked from ranjanlahiri/fis2-postgres-springboot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamel-context.xml
More file actions
131 lines (131 loc) · 7.76 KB
/
Copy pathcamel-context.xml
File metadata and controls
131 lines (131 loc) · 7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<!-- Define a traditional camel context here -->
<cxf:cxfEndpoint address="/employeeWS" id="employeeWS" serviceClass="org.jboss.fis2.demo.soap.EmployeeWS">
<cxf:properties>
<entry key="dataFormat" value="POJO"/>
<entry key="faultStackTraceEnabled" value="true"/>
<entry key="loggingFeatureEnabled" value="false"/>
</cxf:properties>
</cxf:cxfEndpoint>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route id="employeeWS">
<from id="_from1" uri="employeeWS"/>
<removeHeader headerName="SOAPAction" id="_removeHeader1"/>
<recipientList id="_recipientList1">
<simple>direct:${header.operationName}</simple>
</recipientList>
</route>
<route id="getEmployee">
<from id="_from3" uri="direct:getEmployee"/>
<convertBodyTo id="_convertBodyTo2" type="java.lang.Integer"/>
<log id="_log3" message="receive request ${body}"/>
<setProperty id="_setProperty1" propertyName="employee">
<simple>${body}</simple>
</setProperty>
<to uri="sql: select * from employee where id = :#${body}? dataSource=dsFis2&outputType=SelectOne &outputClass=org.jboss.fis2.demo.soap.Employee"/>
<setProperty id="_setProperty2" propertyName="employee">
<simple>${body}</simple>
</setProperty>
<to uri="sql: select * from phone where employee_id = :#${property.employee.id}? dataSource=dsFis2&outputType=SelectList &outputClass=org.jboss.fis2.demo.soap.Phone"/>
<bean id="_bean1" method="putPhoneList" ref="myTransformer"/>
<setBody id="_setBody1">
<simple>${property.employee}</simple>
</setBody>
<log id="_log4" message="send response ${body}"/>
</route>
<route id="getEmployeeAll">
<from id="_from4" uri="direct:getEmployeeAll"/>
<log id="_log5" message="receive request ${body}"/>
<setProperty id="_setProperty3" propertyName="employeeList">
<method method="createEmployeeList" ref="myTransformer"/>
</setProperty>
<to uri="sql: select * from employee? dataSource=dsFis2&outputType=SelectList &outputClass=org.jboss.fis2.demo.soap.Employee"/>
<bean id="_bean2" method="putEmployeeList" ref="myTransformer"/>
<split id="_split1">
<simple>${property.employeeList.employeeList}</simple>
<setProperty id="_setProperty4" propertyName="employee">
<simple>${body}</simple>
</setProperty>
<to uri="sql: select * from phone where employee_id = :#${property.employee.id}? dataSource=dsFis2&outputType=SelectList &outputClass=org.jboss.fis2.demo.soap.Phone"/>
<bean id="_bean3" method="putPhoneList" ref="myTransformer"/>
</split>
<setBody id="_setBody2">
<simple>${property.employeeList}</simple>
</setBody>
<log id="_log6" message="send response ${body}"/>
</route>
<route id="getEmployeeList">
<from id="_from5" uri="direct:getEmployeeList"/>
<convertBodyTo id="_convertBodyTo3" type="java.lang.String"/>
<log id="_log7" message="receive request ${body}"/>
<setProperty id="_setProperty5" propertyName="employeeList">
<method method="createEmployeeList" ref="myTransformer"/>
</setProperty>
<to uri="sql: select * from employee where name like :#${body}? dataSource=dsFis2&outputType=SelectList &outputClass=org.jboss.fis2.demo.soap.Employee"/>
<bean id="_bean4" method="putEmployeeList" ref="myTransformer"/>
<log id="_log8" message="employeelist ${property.employeeList}"/>
<split id="_split2">
<simple>${property.employeeList.employeeList}</simple>
<setProperty id="_setProperty6" propertyName="employee">
<simple>${body}</simple>
</setProperty>
<to uri="sql: select * from phone where employee_id = :#${property.employee.id}? dataSource=dsFis2&outputType=SelectList &outputClass=org.jboss.fis2.demo.soap.Phone"/>
<bean id="_bean5" method="putPhoneList" ref="myTransformer"/>
</split>
<setBody id="_setBody3">
<simple>${property.employeeList}</simple>
</setBody>
<log id="_log9" message="send response ${body}"/>
</route>
<route id="addEmployee">
<from id="_from2" uri="direct:addEmployee"/>
<convertBodyTo id="_convertBodyTo1" type="org.jboss.fis2.demo.soap.Employee"/>
<log id="_log1" message="receive request ${body}"/>
<setProperty id="_setProperty7" propertyName="employee">
<simple>${body}</simple>
</setProperty>
<setHeader headerName="CamelSqlRetrieveGeneratedKeys" id="_setHeader1">
<constant>true</constant>
</setHeader>
<to uri="sql: insert into employee (name, address) values (:#${body.name}, :#${body.address})? dataSource=dsFis2&outputType=SelectOne"/>
<log id="_log10" message="body: ${body}"/>
<log id="_log11" message="key: ${header.CamelSqlGeneratedKeyRows[0][id]}"/>
<script id="_script1">
<simple>${property.employee.setId(${header.CamelSqlGeneratedKeyRows[0][id]})}</simple>
</script>
<split id="_split3">
<simple>${property.employee.phoneList}</simple>
<log id="_log12" message="phone: ${body}"/>
<to uri="sql: insert into phone (employee_id, phone, type) values (:#${property.employee.id}, :#${body.phone}, :#${body.type})? dataSource=dsFis2&outputType=SelectOne"/>
</split>
<setBody id="_setBody4">
<simple>${property.employee}</simple>
</setBody>
<log id="_log2" message="send response ${body}"/>
</route>
<route id="addEmployeeBulk">
<from uri="direct:addEmployeeBulk"/>
<convertBodyTo type="org.jboss.fis2.demo.soap.EmployeeList"/>
<log message="receive request ${body}"/>
<delay>
<constant>5000</constant>
</delay>
<setProperty propertyName="employeeList">
<simple>${body}</simple>
</setProperty>
<split>
<simple>${property.employeeList.employeeList}</simple>
<log message="employee: ${body}"/>
<to uri="direct:addEmployee"/>
</split>
<setBody>
<simple>${property.employeeList}</simple>
</setBody>
<log message="send response ${body}"/>
</route>
</camelContext>
</beans>