Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a new example using the Camel-Spring-AMPQ component

  • Loading branch information...
commit 6646289432d98d238bf817c088a17914fbc62b9c 1 parent ea77862
@felipeg48 authored
View
5 01-spring-camel/build.gradle
@@ -13,7 +13,6 @@ dependencies {
groovy 'org.codehaus.groovy:groovy-all:2.0.6'
compile 'org.apache.camel:camel-spring:2.10.3'
compile 'org.grails:grails-spring:2.2.0'
-
- testCompile 'junit:junit:4.8.2'
- testCompile 'org.springframework:spring-test:3.2.0.RELEASE'
+ compile 'org.springframework.amqp:spring-rabbit:1.1.3.RELEASE'
+ runtime 'com.bluelock:camel-spring-amqp:1.4'
}
View
17 01-spring-camel/src/main/groovy/GroovySpringAMQP.groovy
@@ -0,0 +1,17 @@
+
+
+import grails.spring.BeanBuilder
+
+import org.springframework.amqp.core.AmqpTemplate
+
+
+def bb = new BeanBuilder()
+bb.loadBeans("classpath:/META-INF/spring/SpringAMQPBeans.groovy")
+
+def ctx = bb.createApplicationContext()
+
+def template = ctx.getBean(AmqpTemplate.class)
+template.convertAndSend "myqueue", "foo"
+
+def foo = template.receiveAndConvert "myqueue"
+println foo
View
11 01-spring-camel/src/main/groovy/GroovySpringCamelAMQP.groovy
@@ -0,0 +1,11 @@
+
+
+import grails.spring.BeanBuilder
+
+import org.springframework.amqp.core.AmqpTemplate
+
+
+def bb = new BeanBuilder()
+bb.loadBeans("classpath:/META-INF/spring/SpringCamelAMQPBeans.groovy")
+
+def ctx = bb.createApplicationContext()
View
5 01-spring-camel/src/main/groovy/com/itprosmx/spring/camel/SampleBean.groovy
@@ -10,4 +10,9 @@ class SampleBean {
def run(){
println "Hello Groovy Camel"
}
+
+ def message(msg){
+ def result = new String(msg)
+ println "Got: $result"
+ }
}
View
10 01-spring-camel/src/main/resources/META-INF/spring/SpringAMQPBeans.groovy
@@ -0,0 +1,10 @@
+beans{
+
+ xmlns rabbit:'http://www.springframework.org/schema/rabbit'
+
+ rabbit.'connection-factory'(id:'connectionFactory', username:'guest', password:'guest', host:'localhost' )
+ rabbit.'template'(id:"amqpTemplate",'connection-factory':'connectionFactory')
+ rabbit.'admin'('connection-factory':'connectionFactory')
+ rabbit.'queue'(name:'myqueue')
+
+}
View
22 01-spring-camel/src/main/resources/META-INF/spring/SpringCamelAMQPBeans.groovy
@@ -0,0 +1,22 @@
+beans{
+
+ sample(com.itprosmx.spring.camel.SampleBean)
+
+ xmlns camel: 'http://camel.apache.org/schema/spring'
+ camel {
+ camelContext(id:'camelContext', trace:true) {
+ camel.'route'{
+ camel.'from'(uri:'spring-amqp:myexchage:myqueue') {}
+ camel.'to'(uri:"bean://sample?method=message") {}
+
+ }
+ }
+ }
+
+ xmlns rabbit:'http://www.springframework.org/schema/rabbit'
+
+ rabbit.'connection-factory'(id:'connectionFactory', username:'guest', password:'guest', host:'localhost' )
+ rabbit.'template'(id:"amqpTemplate",'connection-factory':'connectionFactory')
+ rabbit.'admin'('connection-factory':'connectionFactory')
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.