Permalink
Browse files

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

  • Loading branch information...
1 parent ea77862 commit 6646289432d98d238bf817c088a17914fbc62b9c @felipeg48 committed Feb 27, 2013
@@ -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'
}
@@ -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
@@ -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()
@@ -10,4 +10,9 @@ class SampleBean {
def run(){
println "Hello Groovy Camel"
}
+
+ def message(msg){
+ def result = new String(msg)
+ println "Got: $result"
+ }
}
@@ -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')
+
+}
@@ -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')
+
+}

0 comments on commit 6646289

Please sign in to comment.