You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Geoffry Roberts <ge...@gmail.com> on 2011/09/09 00:36:30 UTC

Karaf Camel and

All,

I'm just getting started with Karaf and am having a small issue.  It seems
blueprint has replaced or is replacing spring. I'm trying to use blueprint
but most examples show spring.

Using Karaf 2.2.2

I want to use camel to send a file from one machine to another.  A file gets
created on machine A and camel is supposed to moved it to machine B.

On machine A camel: polls for a new file then writes it's contents to a jms
queue.
On machine B camel: reads the file from a jms queue and writes it to a local
directory.

Sounds simple!

Camel reads the file well enough, but does not appear to be writing it to
the jms queue.  The activemq web console never shows any activity.

Here is the xml file I am placing in the karaf deploy directory on machine
A.  Do I have this right?

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="file:/home/karaf?noop=true" />
            <to uri="jms:queue:biofiles" />
<!-- If I do this, the file does appear in standard out:  <to
uri="stream:out" />  -->
        </route>
    </camelContext>
</blueprint>

I have karaf setup and working on both machines.  I have installed the
following camel and activemq features:

   - activemq
   - activemq-blueprint
   - activemq-web-console
   - camel
   - camel-blueprint
   - camel-jms

Thanks in advance.
-- 
Geoffry Roberts

Re: Karaf Camel and

Posted by Geoffry Roberts <ge...@gmail.com>.
I solved the problem with activemq-camel 5.5.0 by simply dropping the file:
"activemq-camel-5.5.0.jar" into the deploy directory.  I also deleted the
file: "localhost-broker.xml".  After these two actions, the following
blueprint  (See below.) succeeds in placing a bit of text on the queue of
the local activemq broker. i.e. my machine A.  Now the challenge is to read
from said queue and write the message to standard out.   It doesn't seem to
be working.  (See below for the blueprint from machine B.)

Blueprint file on machine A:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="tcp://machineA:61616" />
    </bean>
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="timer:test?period=5000" />
            <setBody>
                <constant>Ave Mundus!!</constant>
            </setBody>
            <to uri="jms:queue:ave" />
        </route>
    </camelContext>
</blueprint>

**********************
Blueprint file on machine B:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="tcp://machineA:61616" />
    </bean>
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="jms:queue:ave" />
            <to uri="stream:out" />
        </route>
    </camelContext>
</blueprint>

On 9 September 2011 13:09, ben.oday <be...@initekconsulting.com> wrote:

> gcr, activemq-camel is correct, but I can't get 5.5.0 to install either at
> the moment...5.4.2 works fine
> though...
>
> karaf@root> osgi:install -s mvn:org.apache.activemq/activemq-camel/5.5.0
> Error executing command: Unresolved constraint in bundle
> org.apache.activemq.activemq-camel [125]: Unable to resolve 125.0: missing
> requirement [125.0] package;
>  (&(package=org.apache.activemq)(version>=5.5.0)(!(version>=6.0.0)))
>
>
> gcr wrote:
> >
> > Thanks for the help so far, but I still have a few issues.
> >
> > When I add the <bean id="jms" ...> as Claus advised, I get a log entry
> > that
> > says that karaf can't find "org.apache.activemq.camel.component".  To
> > remedy
> > this, I  attempted to do the following at the karaf client CLI:
> >
> > karaf@root> osgi:install -s mvn:org.apache.activemq/activemq-camel/5.5.0
> >
> > The response is a complaint that the URL cannot be resolved.
> >
> > Am I on the right track?  if not, from where can I get
> > "org.apache.activemq.camel.component"?
> >
> > Thanks
> >
> > On 8 September 2011 23:09, Claus Ibsen &lt;claus.ibsen@gmail.com&gt;
> > wrote:
> >
> >> Hi
> >>
> >> Yeah you need to Camel which JMS Broker to use.
> >>
> >> I assume you are using Apache ActiveMQ which can be embedded easily,
> >> in one of the machines.
> >>
> >> So basically you just have to add a <bean id="jms" ...> as shown here
> >> http://camel.apache.org/activemq
> >>
> >>  <bean id="jms"
> >>      class="org.apache.activemq.camel.component.ActiveMQComponent">
> >>      <property name="brokerURL" value="tcp://somehost:61616"/>
> >>   </bean>
> >>
> >> And then you need to set the brokerURL to the IP of the target broker.
> >>
> >>
> >>
> >> On Fri, Sep 9, 2011 at 3:04 AM, Geoffry Roberts
> >> &lt;geoffry.roberts@gmail.com&gt; wrote:
> >> > Thanks for the quick response.
> >> >
> >> > Did you mean I should define a connection factory pointing to machine
> >> B?
> >>  I
> >> > ask this because on machine A camel and activemq are in the same jvm.
> >> > On 8 September 2011 16:58, Johan Edstrom &lt;seijoed@gmail.com&gt;
> >> wrote:
> >> >>
> >> >> You need to define a connection factory, jms component etc if you are
> >> >> connecting to an external entity.
> >> >> On Sep 8, 2011, at 18:36, Geoffry Roberts
> >> &lt;geoffry.roberts@gmail.com&gt;
> >> >> wrote:
> >> >>
> >> >> All,
> >> >>
> >> >> I'm just getting started with Karaf and am having a small issue.  It
> >> seems
> >> >> blueprint has replaced or is replacing spring. I'm trying to use
> >> blueprint
> >> >> but most examples show spring.
> >> >>
> >> >> Using Karaf 2.2.2
> >> >>
> >> >> I want to use camel to send a file from one machine to another.  A
> >> file
> >> >> gets created on machine A and camel is supposed to moved it to
> machine
> >> B.
> >> >>
> >> >> On machine A camel: polls for a new file then writes it's contents to
> >> a
> >> >> jms queue.
> >> >> On machine B camel: reads the file from a jms queue and writes it to
> a
> >> >> local directory.
> >> >>
> >> >> Sounds simple!
> >> >>
> >> >> Camel reads the file well enough, but does not appear to be writing
> it
> >> to
> >> >> the jms queue.  The activemq web console never shows any activity.
> >> >>
> >> >> Here is the xml file I am placing in the karaf deploy directory on
> >> machine
> >> >> A.  Do I have this right?
> >> >>
> >> >> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
> >> >>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
> >> >>         <route>
> >> >>             <from uri="file:/home/karaf?noop=true" />
> >> >>             <to uri="jms:queue:biofiles" />
> >> >>
> >> >>         </route>
> >> >>     </camelContext>
> >> >> </blueprint>
> >> >>
> >> >> I have karaf setup and working on both machines.  I have installed
> the
> >> >> following camel and activemq features:
> >> >>
> >> >> activemq
> >> >> activemq-blueprint
> >> >> activemq-web-console
> >> >> camel
> >> >> camel-blueprint
> >> >> camel-jms
> >> >>
> >> >> Thanks in advance.
> >> >> --
> >> >> Geoffry Roberts
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Geoffry Roberts
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
> >
> >
> >
> > --
> > Geoffry Roberts
> >
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-Camel-and-tp3321396p3323977.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
Geoffry Roberts

Re: Karaf Camel and

Posted by "ben.oday" <be...@initekconsulting.com>.
gcr, activemq-camel is correct, but I can't get 5.5.0 to install either at
the moment...5.4.2 works fine 
though...

karaf@root> osgi:install -s mvn:org.apache.activemq/activemq-camel/5.5.0
Error executing command: Unresolved constraint in bundle
org.apache.activemq.activemq-camel [125]: Unable to resolve 125.0: missing
requirement [125.0] package;
 (&(package=org.apache.activemq)(version>=5.5.0)(!(version>=6.0.0)))


gcr wrote:
> 
> Thanks for the help so far, but I still have a few issues.
> 
> When I add the <bean id="jms" ...> as Claus advised, I get a log entry
> that
> says that karaf can't find "org.apache.activemq.camel.component".  To
> remedy
> this, I  attempted to do the following at the karaf client CLI:
> 
> karaf@root> osgi:install -s mvn:org.apache.activemq/activemq-camel/5.5.0
> 
> The response is a complaint that the URL cannot be resolved.
> 
> Am I on the right track?  if not, from where can I get
> "org.apache.activemq.camel.component"?
> 
> Thanks
> 
> On 8 September 2011 23:09, Claus Ibsen &lt;claus.ibsen@gmail.com&gt;
> wrote:
> 
>> Hi
>>
>> Yeah you need to Camel which JMS Broker to use.
>>
>> I assume you are using Apache ActiveMQ which can be embedded easily,
>> in one of the machines.
>>
>> So basically you just have to add a <bean id="jms" ...> as shown here
>> http://camel.apache.org/activemq
>>
>>  <bean id="jms"
>>      class="org.apache.activemq.camel.component.ActiveMQComponent">
>>      <property name="brokerURL" value="tcp://somehost:61616"/>
>>   </bean>
>>
>> And then you need to set the brokerURL to the IP of the target broker.
>>
>>
>>
>> On Fri, Sep 9, 2011 at 3:04 AM, Geoffry Roberts
>> &lt;geoffry.roberts@gmail.com&gt; wrote:
>> > Thanks for the quick response.
>> >
>> > Did you mean I should define a connection factory pointing to machine
>> B?
>>  I
>> > ask this because on machine A camel and activemq are in the same jvm.
>> > On 8 September 2011 16:58, Johan Edstrom &lt;seijoed@gmail.com&gt;
>> wrote:
>> >>
>> >> You need to define a connection factory, jms component etc if you are
>> >> connecting to an external entity.
>> >> On Sep 8, 2011, at 18:36, Geoffry Roberts
>> &lt;geoffry.roberts@gmail.com&gt;
>> >> wrote:
>> >>
>> >> All,
>> >>
>> >> I'm just getting started with Karaf and am having a small issue.  It
>> seems
>> >> blueprint has replaced or is replacing spring. I'm trying to use
>> blueprint
>> >> but most examples show spring.
>> >>
>> >> Using Karaf 2.2.2
>> >>
>> >> I want to use camel to send a file from one machine to another.  A
>> file
>> >> gets created on machine A and camel is supposed to moved it to machine
>> B.
>> >>
>> >> On machine A camel: polls for a new file then writes it's contents to
>> a
>> >> jms queue.
>> >> On machine B camel: reads the file from a jms queue and writes it to a
>> >> local directory.
>> >>
>> >> Sounds simple!
>> >>
>> >> Camel reads the file well enough, but does not appear to be writing it
>> to
>> >> the jms queue.  The activemq web console never shows any activity.
>> >>
>> >> Here is the xml file I am placing in the karaf deploy directory on
>> machine
>> >> A.  Do I have this right?
>> >>
>> >> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>> >>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>> >>         <route>
>> >>             <from uri="file:/home/karaf?noop=true" />
>> >>             <to uri="jms:queue:biofiles" />
>> >> 
>> >>         </route>
>> >>     </camelContext>
>> >> </blueprint>
>> >>
>> >> I have karaf setup and working on both machines.  I have installed the
>> >> following camel and activemq features:
>> >>
>> >> activemq
>> >> activemq-blueprint
>> >> activemq-web-console
>> >> camel
>> >> camel-blueprint
>> >> camel-jms
>> >>
>> >> Thanks in advance.
>> >> --
>> >> Geoffry Roberts
>> >>
>> >
>> >
>> >
>> > --
>> > Geoffry Roberts
>> >
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
> 
> 
> 
> -- 
> Geoffry Roberts
> 


--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-Camel-and-tp3321396p3323977.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf Camel and

Posted by Geoffry Roberts <ge...@gmail.com>.
Thanks for the help so far, but I still have a few issues.

When I add the <bean id="jms" ...> as Claus advised, I get a log entry that
says that karaf can't find "org.apache.activemq.camel.component".  To remedy
this, I  attempted to do the following at the karaf client CLI:

karaf@root> osgi:install -s mvn:org.apache.activemq/activemq-camel/5.5.0

The response is a complaint that the URL cannot be resolved.

Am I on the right track?  if not, from where can I get
"org.apache.activemq.camel.component"?

Thanks

On 8 September 2011 23:09, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Yeah you need to Camel which JMS Broker to use.
>
> I assume you are using Apache ActiveMQ which can be embedded easily,
> in one of the machines.
>
> So basically you just have to add a <bean id="jms" ...> as shown here
> http://camel.apache.org/activemq
>
>  <bean id="jms"
>      class="org.apache.activemq.camel.component.ActiveMQComponent">
>      <property name="brokerURL" value="tcp://somehost:61616"/>
>   </bean>
>
> And then you need to set the brokerURL to the IP of the target broker.
>
>
>
> On Fri, Sep 9, 2011 at 3:04 AM, Geoffry Roberts
> <ge...@gmail.com> wrote:
> > Thanks for the quick response.
> >
> > Did you mean I should define a connection factory pointing to machine B?
>  I
> > ask this because on machine A camel and activemq are in the same jvm.
> > On 8 September 2011 16:58, Johan Edstrom <se...@gmail.com> wrote:
> >>
> >> You need to define a connection factory, jms component etc if you are
> >> connecting to an external entity.
> >> On Sep 8, 2011, at 18:36, Geoffry Roberts <ge...@gmail.com>
> >> wrote:
> >>
> >> All,
> >>
> >> I'm just getting started with Karaf and am having a small issue.  It
> seems
> >> blueprint has replaced or is replacing spring. I'm trying to use
> blueprint
> >> but most examples show spring.
> >>
> >> Using Karaf 2.2.2
> >>
> >> I want to use camel to send a file from one machine to another.  A file
> >> gets created on machine A and camel is supposed to moved it to machine
> B.
> >>
> >> On machine A camel: polls for a new file then writes it's contents to a
> >> jms queue.
> >> On machine B camel: reads the file from a jms queue and writes it to a
> >> local directory.
> >>
> >> Sounds simple!
> >>
> >> Camel reads the file well enough, but does not appear to be writing it
> to
> >> the jms queue.  The activemq web console never shows any activity.
> >>
> >> Here is the xml file I am placing in the karaf deploy directory on
> machine
> >> A.  Do I have this right?
> >>
> >> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
> >>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
> >>         <route>
> >>             <from uri="file:/home/karaf?noop=true" />
> >>             <to uri="jms:queue:biofiles" />
> >> <!-- If I do this, the file does appear in standard out:  <to
> >> uri="stream:out" />  -->
> >>         </route>
> >>     </camelContext>
> >> </blueprint>
> >>
> >> I have karaf setup and working on both machines.  I have installed the
> >> following camel and activemq features:
> >>
> >> activemq
> >> activemq-blueprint
> >> activemq-web-console
> >> camel
> >> camel-blueprint
> >> camel-jms
> >>
> >> Thanks in advance.
> >> --
> >> Geoffry Roberts
> >>
> >
> >
> >
> > --
> > Geoffry Roberts
> >
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Geoffry Roberts

Re: Karaf Camel and

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah you need to Camel which JMS Broker to use.

I assume you are using Apache ActiveMQ which can be embedded easily,
in one of the machines.

So basically you just have to add a <bean id="jms" ...> as shown here
http://camel.apache.org/activemq

 <bean id="jms"
      class="org.apache.activemq.camel.component.ActiveMQComponent">
      <property name="brokerURL" value="tcp://somehost:61616"/>
   </bean>

And then you need to set the brokerURL to the IP of the target broker.



On Fri, Sep 9, 2011 at 3:04 AM, Geoffry Roberts
<ge...@gmail.com> wrote:
> Thanks for the quick response.
>
> Did you mean I should define a connection factory pointing to machine B?  I
> ask this because on machine A camel and activemq are in the same jvm.
> On 8 September 2011 16:58, Johan Edstrom <se...@gmail.com> wrote:
>>
>> You need to define a connection factory, jms component etc if you are
>> connecting to an external entity.
>> On Sep 8, 2011, at 18:36, Geoffry Roberts <ge...@gmail.com>
>> wrote:
>>
>> All,
>>
>> I'm just getting started with Karaf and am having a small issue.  It seems
>> blueprint has replaced or is replacing spring. I'm trying to use blueprint
>> but most examples show spring.
>>
>> Using Karaf 2.2.2
>>
>> I want to use camel to send a file from one machine to another.  A file
>> gets created on machine A and camel is supposed to moved it to machine B.
>>
>> On machine A camel: polls for a new file then writes it's contents to a
>> jms queue.
>> On machine B camel: reads the file from a jms queue and writes it to a
>> local directory.
>>
>> Sounds simple!
>>
>> Camel reads the file well enough, but does not appear to be writing it to
>> the jms queue.  The activemq web console never shows any activity.
>>
>> Here is the xml file I am placing in the karaf deploy directory on machine
>> A.  Do I have this right?
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>>         <route>
>>             <from uri="file:/home/karaf?noop=true" />
>>             <to uri="jms:queue:biofiles" />
>> <!-- If I do this, the file does appear in standard out:  <to
>> uri="stream:out" />  -->
>>         </route>
>>     </camelContext>
>> </blueprint>
>>
>> I have karaf setup and working on both machines.  I have installed the
>> following camel and activemq features:
>>
>> activemq
>> activemq-blueprint
>> activemq-web-console
>> camel
>> camel-blueprint
>> camel-jms
>>
>> Thanks in advance.
>> --
>> Geoffry Roberts
>>
>
>
>
> --
> Geoffry Roberts
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Karaf Camel and

Posted by Geoffry Roberts <ge...@gmail.com>.
Thanks for the quick response.

Did you mean I should define a connection factory pointing to machine B?  I
ask this because on machine A camel and activemq are in the same jvm.

On 8 September 2011 16:58, Johan Edstrom <se...@gmail.com> wrote:

> You need to define a connection factory, jms component etc if you are
> connecting to an external entity.
>
> On Sep 8, 2011, at 18:36, Geoffry Roberts <ge...@gmail.com>
> wrote:
>
> All,
>
> I'm just getting started with Karaf and am having a small issue.  It seems
> blueprint has replaced or is replacing spring. I'm trying to use blueprint
> but most examples show spring.
>
> Using Karaf 2.2.2
>
> I want to use camel to send a file from one machine to another.  A file
> gets created on machine A and camel is supposed to moved it to machine B.
>
> On machine A camel: polls for a new file then writes it's contents to a jms
> queue.
> On machine B camel: reads the file from a jms queue and writes it to a
> local directory.
>
> Sounds simple!
>
> Camel reads the file well enough, but does not appear to be writing it to
> the jms queue.  The activemq web console never shows any activity.
>
> Here is the xml file I am placing in the karaf deploy directory on machine
> A.  Do I have this right?
>
> <blueprint xmlns=" <http://www.osgi.org/xmlns/blueprint/v1.0.0>
> http://www.osgi.org/xmlns/blueprint/v1.0.0">
>     <camelContext xmlns=" <http://camel.apache.org/schema/blueprint>
> http://camel.apache.org/schema/blueprint">
>         <route>
>             <from uri="file:/home/karaf?noop=true" />
>             <to uri="jms:queue:biofiles" />
> <!-- If I do this, the file does appear in standard out:  <to
> uri="stream:out" />  -->
>         </route>
>     </camelContext>
> </blueprint>
>
> I have karaf setup and working on both machines.  I have installed the
> following camel and activemq features:
>
>    - activemq
>    - activemq-blueprint
>    - activemq-web-console
>    - camel
>    - camel-blueprint
>    - camel-jms
>
> Thanks in advance.
> --
> Geoffry Roberts
>
>


-- 
Geoffry Roberts

Re: Karaf Camel and

Posted by Johan Edstrom <se...@gmail.com>.
You need to define a connection factory, jms component etc if you are connecting to an external entity.

On Sep 8, 2011, at 18:36, Geoffry Roberts <ge...@gmail.com> wrote:

> All,
> 
> I'm just getting started with Karaf and am having a small issue.  It seems blueprint has replaced or is replacing spring. I'm trying to use blueprint but most examples show spring.
> 
> Using Karaf 2.2.2
> 
> I want to use camel to send a file from one machine to another.  A file gets created on machine A and camel is supposed to moved it to machine B.  
> 
> On machine A camel: polls for a new file then writes it's contents to a jms queue.
> On machine B camel: reads the file from a jms queue and writes it to a local directory.
> 
> Sounds simple!
> 
> Camel reads the file well enough, but does not appear to be writing it to the jms queue.  The activemq web console never shows any activity.
> 
> Here is the xml file I am placing in the karaf deploy directory on machine A.  Do I have this right?
> 
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>         <route>
>             <from uri="file:/home/karaf?noop=true" />
>             <to uri="jms:queue:biofiles" />
> <!-- If I do this, the file does appear in standard out:  <to uri="stream:out" />  -->
>         </route>
>     </camelContext>
> </blueprint>
> 
> I have karaf setup and working on both machines.  I have installed the following camel and activemq features:
> activemq
> activemq-blueprint
> activemq-web-console
> camel
> camel-blueprint
> camel-jms
> Thanks in advance.
> -- 
> Geoffry Roberts
>