You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/23 13:34:03 UTC
[camel-kamelets-examples] branch main updated: CAMEL-19772: camel-core - Dump routes to include custom beans
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 401b458 CAMEL-19772: camel-core - Dump routes to include custom beans
401b458 is described below
commit 401b45885504f01c9e04752832e1cd88eb05739a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 23 15:33:55 2023 +0200
CAMEL-19772: camel-core - Dump routes to include custom beans
---
jbang/xml-to-yaml/Address.java | 24 ++++++++++++++++++++++++
jbang/xml-to-yaml/OrderService.java | 13 ++++++++++++-
jbang/xml-to-yaml/order-spring.xml | 24 ++++++++++++++++++++++++
jbang/xml-to-yaml/order.xml | 18 ------------------
4 files changed, 60 insertions(+), 19 deletions(-)
diff --git a/jbang/xml-to-yaml/Address.java b/jbang/xml-to-yaml/Address.java
new file mode 100644
index 0000000..c251979
--- /dev/null
+++ b/jbang/xml-to-yaml/Address.java
@@ -0,0 +1,24 @@
+package com.foo;
+
+public class Address {
+
+ private int zip;
+ private String street;
+
+ public int getZip() {
+ return zip;
+ }
+
+ public void setZip(int zip) {
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+}
\ No newline at end of file
diff --git a/jbang/xml-to-yaml/OrderService.java b/jbang/xml-to-yaml/OrderService.java
index 17935ac..36495bf 100644
--- a/jbang/xml-to-yaml/OrderService.java
+++ b/jbang/xml-to-yaml/OrderService.java
@@ -1,8 +1,11 @@
package com.foo;
+import com.foo.Address;
+
public class OrderService {
private String customer;
+ private Address address;
public void setCustomer(String customer) {
this.customer = customer;
@@ -12,8 +15,16 @@ public class OrderService {
return customer;
}
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
public String processorOrder(String id) {
- return "Order " + id + " ordered by " + customer;
+ return "Order " + id + " ordered by " + customer + " to " + address.getStreet();
}
}
\ No newline at end of file
diff --git a/jbang/xml-to-yaml/order-spring.xml b/jbang/xml-to-yaml/order-spring.xml
new file mode 100644
index 0000000..33f613e
--- /dev/null
+++ b/jbang/xml-to-yaml/order-spring.xml
@@ -0,0 +1,24 @@
+<camel>
+
+ <!-- embedded spring-xml beans -->
+ <beans xmlns="http://www.springframework.org/schema/beans">
+ <bean id="office" class="com.foo.Address">
+ <property name="zip" value="1234"/>
+ <property name="street" value="Gardenstreet 444"/>
+ </bean>
+ <bean id="orderService" class="com.foo.OrderService">
+ <property name="customer" value="Acme"/>
+ <property name="address" ref="office"/>
+ </bean>
+ </beans>
+
+ <route>
+ <from uri="timer:xml?period={{time:1000}}"/>
+ <setBody>
+ <simple>${random(1000)}</simple>
+ </setBody>
+ <bean ref="orderService"/>
+ <log message="${body}"/>
+ </route>
+
+</camel>
diff --git a/jbang/xml-to-yaml/order.xml b/jbang/xml-to-yaml/order.xml
deleted file mode 100644
index 1ef2c07..0000000
--- a/jbang/xml-to-yaml/order.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<camel>
-
- <bean name="orderService" type="com.foo.OrderService">
- <properties>
- <property key="customer" value="Acme"/>
- </properties>
- </bean>
-
- <route>
- <from uri="timer:xml?period={{time:1000}}"/>
- <setBody>
- <simple>${random(1000)}</simple>
- </setBody>
- <bean ref="orderService"/>
- <log message="${body}"/>
- </route>
-
-</camel>