How To Check If A Networked Connector Is Up

2010-01-21 Thread Carlo Camerino
Hi,

I have a sistuation in which i use a network connector to communicate with
another broker,
my problem is that when the other networked connector is turned off,
activemq still trys to send a message to

i'm using producertemplate in camel btw,

object.sendRequest(body, activemq:financials);

financials is a queue which is configured to do a store and forward to the
other broker residing on another system.
]


is there any way i could check that if networkbroker a's connection to
networkbroker b is down,
the system will automatically throw an exception.

The default behavior seems to be, when i place a message on the queue on
broker a, the system still waits for the message to timeout.

It doesn't alert me that no connection is available at all.

How can this be avoided?

Thanks A lot


Re: camel 2.1 with geronimo 2.2 (activemq 3.5)

2010-01-21 Thread Charles Moulliard
I have made a test in Geronimo with camel-core, camel-spring jars added in
the folder lib but I got the same error as Ulise.

007 ERROR [GBeanInstanceState] Error while starting; GBean is now in the
FAILED state:

abstractName=org.apache.geronimo.configs/activemq-broker/2.2/car?ServiceModule=org.apache.geronimo.configs/activemq-broker/2.2/car,j2eeType=JMSServer,name=DefaultActiveMQBroker
org.springframework.beans.factory.BeanDefinitionStoreException:
 Unrecognized xbean namespace mapping:
http://camel.apache.org/schema/spring

I think that there is a missing dependency or a bad config in the CAR
activemq-broker/2.2/car component located here

geronimo-jetty7-javaee5-2.2\repository\org\apache\geronimo\configs\activemq-broker\2.2\activemq-broker-2.2.car\META-INF

Help from Geronimo team is required to address this point.

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=gid=2447439trk=anet_ug_hm


On Wed, Jan 20, 2010 at 9:35 PM, ulise uli@googlemail.com wrote:


 Hi Claus,

 well, it´s somewhat unclear to me how to configure a kind of a
 listening-service based on camel in geronimo. I´m a bit JBoss-minded. ;-)
 I thing, I have to create a car? Can I use a jmx-mbean? That's why I was
 glad to find the posibillity using the ActiveMQ Spring config. OK, I´ll
 look
 for another way.

 Here are my activemq.xml fragments.


 beans
  xmlns=http://www.springframework.org/schema/beans;
  xmlns:amq=http://activemq.apache.org/schema/core;
  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-2.0.xsd
  http://activemq.apache.org/schema/core
 http://activemq.apache.org/schema/core/activemq-core.xsd
   http://camel.apache.org/schema/spring
 http://camel.apache.org/schema/spring/camel-spring.xsd;

!-- Allows us to use system properties as variables in this
 configuration file--
bean
 class=org.apache.geronimo.activemq.GeronimoPropertyPlaceholderConfigurer
 property name=locations
 .

 other stuff

 .
 camelContext id=camel xmlns=
 http://camel.apache.org/schema/spring;
route
from uri=activemq:example.A/
to uri=activemq:example.B/
/route
/camelContext
 .
 /beans

 Cheers and thanks,
 Uli



 Claus Ibsen-2 wrote:
 
  Try without AMQ at first.
 
  And can you post the top of the XML file, the stuff with all those
  namespace and whatnot.
 
 
  On Wed, Jan 20, 2010 at 5:28 PM, ulise uli@googlemail.com wrote:
 
  Hi
  I tried to run camel in a freshly downloaded
  geronimo-tomcat6-javaee5-2.2.
  I simply uncommented the
 
 camelContext id=camel
  xmlns=http://camel.apache.org/schema/spring;
 route
 from uri=activemq:example.A/
 to uri=activemq:example.B/
 /route
 /camelContext
 
  part in the activemx.xml and changed all the URLs as told in
 
  http://camel.apache.org/exception-beandefinitionstoreexception.html
 
  but I still get this  exception
 
  007 ERROR [GBeanInstanceState] Error while starting; GBean is now in the
  FAILED state:
 
 abstractName=org.apache.geronimo.configs/activemq-broker/2.2/car?ServiceModule=org.apache.geronimo.configs/activemq-broker/2.2/car,j2eeType=JMSServer,na
  me=DefaultActiveMQBroker
  org.springframework.beans.factory.BeanDefinitionStoreException:
  Unrecognized
  xbean namespace mapping: http://camel.apache.org/schema/spring
 
  Do I have install some more jars, plugins? Are there any? Is there a
  tutorial of running camel with geronimo (as a kind of service)
 
  Many thanks for any help,
 
  Uli
  --
  View this message in context:
 
 http://old.nabble.com/camel-2.1-with-geronimo-2.2-%28activemq-3.5%29-tp27244553p27244553.html
  Sent from the Camel - Users mailing list archive at Nabble.com.
 
 
 
 
 
  --
  Claus Ibsen
  Apache Camel Committer
 
  Author of Camel in Action: http://www.manning.com/ibsen/
  Open Source Integration: http://fusesource.com
  Blog: http://davsclaus.blogspot.com/
  Twitter: http://twitter.com/davsclaus
 
 

 --
 View this message in context:
 http://old.nabble.com/camel-2.1-with-geronimo-2.2-%28activemq-3.5%29-tp27244553p27248191.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




Re: HTTP parameter bug (was passing the HTTPServletRequest from Jetty to a SEDA consumer in Spring DSL)

2010-01-21 Thread Willem Jiang
I just did a quick test on camel trunk, you can get the URL parameters 
by using the

exchange.getIn().getHeader(Exchange.HTTP_QUERY)
When you post the binary data with URI Query.

I just took a look at camel-http and found we could parser the URL 
parameter for the post method.


So I created a JIRA[1] and will submit a quick fix for it.

[1] https://issues.apache.org/activemq/browse/CAMEL-2386

Willem

Wayne Keenan wrote:

Hi,

Nope, I am POSTing binary data as the body with a content-type of  '
application/octet-stream', and am sending additional parameters in the URI
Query that are not appearing as Camel headers.

Perhaps this is not 'best practice', and the body should be multipart MIME
encoded so it can be POST'ed as application/x-www-form-urlencoded, but AFAIK
what I'm currently doing isn't outlawed by HTTP.

Regards
Wayne

On Thu, Jan 21, 2010 at 12:55 AM, Willem Jiang willem.ji...@gmail.comwrote:


Hi,

Is your post request using application/x-www-form-urlencoded as the
content-type ?
If so , you should get the parameters from the message header.


Willem

Wayne Keenan wrote:


Hi,

I believe I have found the trouble I am having.  I think this bug still
exists in the 2.1.0 release:
http://issues.apache.org/activemq/browse/CAMEL-1806

The docs says from: http://camel.apache.org/jetty.html says:

*Camel also populates all request.parameter and request.headers. For
example, given a client request with the URL,
http://myserver/myserver?orderid=123, the exchange will contain a header
named orderid with the value 123. This feature was introduced in Camel
1.5.*

However, the header parameters are only set for GET, not PUT or POST.

Regards
Wayne


On Wed, Jan 20, 2010 at 4:16 PM, Wayne Keenan wayne.kee...@gmail.com

wrote:

 Hi,

Thanks for replying.

On Wed, Jan 20, 2010 at 3:28 PM, Willem Jiang willem.ji...@gmail.com

wrote:

 Hi,

Can you try to set the ID into the message header instead of the message
body ? In this way you can the Request object back :)


   route

   from uri=jetty:http://0.0.0.0:8080/endpoint/
   inOnly uri=seda:sendASync/
   setHeader headerName=id
simple${id}/simple
   /setHeader
   /route

   route
   from uri=seda:sendASync/
   to uri=bean:myBean/
   /route


You bean's method could

public String controller(@Header(id)String body, Exchange exchange) ;



 The request body contains base64 encoded POST I want.

I can get to the body, url paramters and the ID ok without the
intermediate
SEDA route, in the bean I have:



 HttpServletRequest req =
exchange.getIn().getBody(HttpServletRequest.class);

 def corrId = exchange.getIn().getMessageId()

I also can get to the URL (not form encoded) parameters   (e.g. the URL
is:
http://0.0.0.0:65503/endpoint?myParam=value) by using:

 def p1 = req?.getParameter('myParam')



It's ony when I introduce the SEDA that the HttpServletRequest no longer
exists,  (I think), and I am unable to obtain the HTTP parameters from
the
URL

Perhaps I should be copying the HTTP parameters to Camel message
properties?  That way my bean can be less dependent on the HTTP protocol.

Is that something someone would be able to give me an example of please?
Is there a built-in way to auto populate Camel message properties with
HTTP
properties

Alternatively, sticking with HTTP aware bean,I just get null using:

println exchange.getProperty(Exchange.HTTP_QUERY)
or
println exchange.getIn().getProperty(Exchange.HTTP_QUERY)



Regards
Wayne



 Willem


Wayne Keenan wrote:

 Hi,

Apologies, I didn't word my previous email very well; what I should
have
also mentioned for clarity is that if I do this:

  route
  from uri=jetty:http://0.0.0.0:8080/endpoint/
  to uri=bean:myBean/
  transform
  simple${id}/simple
  /transform
  /route

The same bean is able to obtain the HTTPServletRequest to get the POST
data
(base64 encoded binary) andthe URL parameters,  however,  if I
introduce
the
SEDA
call the same bean can't get the HTTPServletRequest. The salient bean
code
is:

 public String controller(String body, Exchange exchange) {

  try {
HttpServletRequest req =
exchange.getIn().getBody(HttpServletRequest.class);


Regards
Wayne

On Wed, Jan 20, 2010 at 9:02 AM, Wayne Keenan wayne.kee...@gmail.com


wrote:


 Hi,


I have a Jetty endpoint that when recieving a message will perform the
processing asynchronously and syncronously return a correlationId so
the
client can come back later to another endpoint to see how processsing
is
going.

I found an example on the mailing list of how to pass the HttpSession
object using Java, but I can't seem to find out how
to reference or pass the HttpRequest using SpringDSL.  What I have at
the
moment is:


  route
  from uri=jetty:http://0.0.0.0:8080/endpoint/
  inOnly uri=seda:sendASync/
  transform
  simple${id}/simple
  /transform
  

Re: How To Check If A Networked Connector Is Up

2010-01-21 Thread Gary Tully
This does not sound right. The store and forward should happen async and
should block pending a reconnect of the networkconnector in the event of a
failure of the second broker.
Can you post your activemq configuration?

An active network connector is visible in JMX so you could validate its
state through a JMX query but you should not need to be aware of that state
when producing messages.

2010/1/21 Carlo Camerino carlo.camer...@gmail.com

 Hi,

 I have a sistuation in which i use a network connector to communicate with
 another broker,
 my problem is that when the other networked connector is turned off,
 activemq still trys to send a message to

 i'm using producertemplate in camel btw,

 object.sendRequest(body, activemq:financials);

 financials is a queue which is configured to do a store and forward to the
 other broker residing on another system.
 ]


 is there any way i could check that if networkbroker a's connection to
 networkbroker b is down,
 the system will automatically throw an exception.

 The default behavior seems to be, when i place a message on the queue on
 broker a, the system still waits for the message to timeout.

 It doesn't alert me that no connection is available at all.

 How can this be avoided?

 Thanks A lot




-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com


Re: How To Check If A Networked Connector Is Up

2010-01-21 Thread Carlo Camerino
Here is a networkbroker , i have an activemqcomponent which connects to
broker client broker.
in turn client broker is connected to another broker

bean id=activemq
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=brokerURL value=tcp://localhost:8010/
/bean

amq:broker brokerName=clientBroker useShutdownHook=true 
amq:networkConnectors
amq:networkConnector  uri=static:(tcp://192.168.253.2:8007)
duplex=true
amq:staticallyIncludedDestinations
amq:queue name = financials physicalName=financials
/amq:queue
/amq:staticallyIncludedDestinations
/amq:networkConnector
/amq:networkConnectors
amq:transportConnectors
amq:transportConnector uri = tcp://localhost:8010 /
/amq:transportConnectors
/amq:broker

Here is the broker for my server

amq:broker id=serverBroker brokerName=serverBroker persistent=false
amq:transportConnectors
amq:transportConnector uri=tcp://localhost:8007/
/amq:transportConnector
/amq:transportConnectors
/amq:broker

bean id=activemq
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=brokerURL value=tcp://localhost:8007/
/bean


On Thu, Jan 21, 2010 at 2:17 AM, Gary Tully gary.tu...@gmail.com wrote:

 This does not sound right. The store and forward should happen async and
 should block pending a reconnect of the networkconnector in the event of a
 failure of the second broker.
 Can you post your activemq configuration?

 An active network connector is visible in JMX so you could validate its
 state through a JMX query but you should not need to be aware of that state
 when producing messages.

 2010/1/21 Carlo Camerino carlo.camer...@gmail.com

  Hi,
 
  I have a sistuation in which i use a network connector to communicate
 with
  another broker,
  my problem is that when the other networked connector is turned off,
  activemq still trys to send a message to
 
  i'm using producertemplate in camel btw,
 
  object.sendRequest(body, activemq:financials);
 
  financials is a queue which is configured to do a store and forward to
 the
  other broker residing on another system.
  ]
 
 
  is there any way i could check that if networkbroker a's connection to
  networkbroker b is down,
  the system will automatically throw an exception.
 
  The default behavior seems to be, when i place a message on the queue
 on
  broker a, the system still waits for the message to timeout.
 
  It doesn't alert me that no connection is available at all.
 
  How can this be avoided?
 
  Thanks A lot
 



 --
 http://blog.garytully.com

 Open Source Integration
 http://fusesource.com



Re: requestBodyAndHeader and HEADER_CLOSE_SESSION_WHEN_COMPLETE

2010-01-21 Thread huntc


Claus Ibsen-2 wrote:
 
 Yes you need to pass in this header every time you want to session closed.
 

I'm pretty convinced that this isn't happening for me despite passing in the
header that I want the session closed when complete (which I presume is when
I get a reply). Here's my log file:


2010-01-21 15:57:59,406 [lCalendarEvents] DEBUG
lendarEventAttendeeSMSNotifier - Sending message to xxx: Reply to confirm
meeting closed Thu, 21 Jan '10 03:35PM Scen 7 # 7
2010-01-21 15:57:59,409 [IoProcessor-1.2] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] CREATED
2010-01-21 15:57:59,409 [IoProcessor-1.2] DEBUG ExecutorFilter
- Launching thread for /192.168.0.200:9500
2010-01-21 15:57:59,410 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] OPENED
2010-01-21 15:57:59,410 [ MinaThreadPool] DEBUG ExecutorFilter
- Exiting since queue is empty for /192.168.0.200:9500
2010-01-21 15:57:59,410 [lCalendarEvents] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] WRITE:
au.com.blueglue.bluegluesmsprotocol.send...@8e1a0d01
2010-01-21 15:57:59,411 [IoProcessor-1.2] DEBUG ExecutorFilter
- Launching thread for /192.168.0.200:9500
2010-01-21 15:57:59,411 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] SENT:
au.com.blueglue.bluegluesmsprotocol.send...@8e1a0d01
2010-01-21 15:57:59,411 [ MinaThreadPool] DEBUG ExecutorFilter
- Exiting since queue is empty for /192.168.0.200:9500
2010-01-21 15:58:10,979 [IoProcessor-1.2] DEBUG ExecutorFilter
- Launching thread for /192.168.0.200:9500
2010-01-21 15:58:10,979 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] RECEIVED:
au.com.blueglue.bluegluesmsprotocol.transmitted...@8e1a0d01
2010-01-21 15:58:10,979 [ MinaThreadPool] DEBUG ExecutorFilter
- Exiting since queue is empty for /192.168.0.200:9500
2010-01-21 15:58:10,979 [lCalendarEvents] DEBUG
lendarEventAttendeeSMSNotifier - Message sent
2010-01-21 15:58:10,980 [lCalendarEvents] DEBUG
lendarEventAttendeeSMSNotifier - Sending message to yyy: Reply to confirm
meeting closed Thu, 21 Jan '10 03:35PM Scen 7 # 7
2010-01-21 15:58:10,980 [lCalendarEvents] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] WRITE:
au.com.blueglue.bluegluesmsprotocol.send...@808819c0
2010-01-21 15:58:10,981 [IoProcessor-1.2] DEBUG ExecutorFilter
- Launching thread for /192.168.0.200:9500
2010-01-21 15:58:10,981 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler  
- [/192.168.0.200:9500] SENT:
au.com.blueglue.bluegluesmsprotocol.send...@808819c0
2010-01-21 15:58:10,981 [ MinaThreadPool] DEBUG ExecutorFilter
- Exiting since queue is empty for /192.168.0.200:9500
2010-01-21 15:58:10,983 [IoProcessor-1.2] DEBUG ExecutorFilter
- Launching thread for /192.168.0.200:9500
...


After the received event at 2010-01-21 15:58:10,979, I was hoping that the
socket would be closed. As you can see there is no trace in the log of the
socket being closed.

Is this a bug or am I not doing something quite right. Here's my code again:


Object replyMessage = producerTemplate
.requestBodyAndHeader(
smsSenderEndpoint,
requestMessage,
MinaConsumer.HEADER_CLOSE_SESSION_WHEN_COMPLETE,
true);


The above template instance is called twice in succession as shown by the
Sending message to entries.

Thanks for your help.

Kind regards,
Christopher
-- 
View this message in context: 
http://old.nabble.com/requestBodyAndHeader-and-HEADER_CLOSE_SESSION_WHEN_COMPLETE-tp27175565p27255912.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-quickfix example

2010-01-21 Thread beat glattfelder

Hey camel riders

I have tried the PassivefixGateway example in the test source, but it did
not behave as expected. Though it's supposed route async responses back to
the client it simply wont. Looking at the source, I reckon this behavior is
by design, since the Processor registered with the quickfix-client
endpoint simply logs the message.
How can one configure the route in the example to relay back messages
through up the route - or am I missing something? 

Thanks a lot

-- 
View this message in context: 
http://old.nabble.com/camel-quickfix-example-tp27256088p27256088.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Jetty Security Handler

2010-01-21 Thread SwenVogel

Hi,

i created a customer jetty security handler and configured the spring
configuration file accordingly.
In the security handler i use my own exec camel component for the
authentication.

In short my exec component can executes external programs and makes use of
the
apache-commons-exec library.

The problem is that the OnCompletition's are not called. When is use the
component
in other routes everything works fine.

Here is the code from my exec producer that adds the OnCompletition:
exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO));


Here the security handler code:

String authEndpoint = exec:authProg?dir=c:/exitValues=0;1args=
+ username + ;
+ credentials;

ProducerTemplate template = camelContext.createProducerTemplate();
Exchange result = template.send(authEndpoint, new
DefaultExchange(camelContext));

Integer exitCode = result.getOut().getHeader(
ExecComponent.EXEC_EXITCODE, Integer.class);

-- 
View this message in context: 
http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html
Sent from the Camel - Users mailing list archive at Nabble.com.



FileConsumer move a file to wrong destination.

2010-01-21 Thread ariablu

using Apache Camel 2.1 and Spring, 
route: File - Processor - (cxf) - Log

When ...
/_work/test/from/1.txt

if I run test case, 1.txt file was moved to
/_work/test/from/.done (not directory!)

But I want
/_work/test/from/.done/1.txt


[[test case]]
 camelContext xmlns=http://camel.apache.org/schema/spring;
   endpoint id=file1
uri=file:C:\_work\test\from?delete=falseamp;noop=falseamp;move=.done/
   route
 from ref=file1/
 process ref=process1/
 !--  to uri=cxf  --
 to
uri=log:testlog?level=INFOamp;showExchangeId=trueamp;showProperties=trueamp;showBodyType=trueamp;showBody=trueamp;showOut=trueamp;multiline=trueamp;showHeaders=true/
   /route
 /camelContext
 bean class=test.impl.Trans id=process1/

[[test processor]]
package test.impl;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class Trans implements Processor {
   public void process(Exchange exchange) throws Exception {
   exchange.getOut().setHeader(operationNameSpace,
http://pc.ws;);
   exchange.getOut().setHeader(operationName, echo);
   exchange.getOut().setBody(new Object[]{A, B});
}   }

[[Log]]
INFO testlog - Exchange[
, Id:ffa13059-6465-4bb0-b9ca-8de545c50618
,
Properties:{CamelToEndpoint=log://testlog?level=INFOmultiline=trueshowBody=trueshowBodyType=trueshowExchangeId=trueshowHeaders=trueshowOut=trueshowProperties=true,
CamelBatchSize=1, CamelBatchComplete=true,
CamelFileExchangeFile=GenericFile[C:\_work\test\from\1.txt],
CamelBatchIndex=0}
, Headers:{operationName=echo, operationNameSpace=http://pc.ws}
, BodyType:Object[]
, Body:[Ljava.lang.Object;@16be13b
, Out: null]
DEBUG GenericFileOnCompletion - Done processing file:
GeneriacFile[C:\_work\test\from\1.txt] using exchange:
Exchange[GenericFileMessage with body: [Ljava.lang.Object;@16be13b]
DEBUG GenericFileRenameProcessStrategy - Renaming file:
GenericFile[C:\_work\test\from\1.txt] to: GenericFile[\\.done]
DEBUG FileUtil - Tried 1 to rename file: C:\_work\test\from\1.txt to:
C:\_work\test\from\.done with result: true


Thanks!
-- 
View this message in context: 
http://old.nabble.com/FileConsumer-move-a-file-to-wrong-destination.-tp27260194p27260194.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Easy One way soap services

2010-01-21 Thread Daniel Kulp


Quite honestly, I'm not sure why the CXF stuff in Camel has to be so
complex.   To me, it should be based more on the technology in CXF that
supports the JAX-WS Dispatch/Provider stuff (or implemented via the JAX-WS
Dispatch/Provider stuff).   In this case, if it was a PAYLOAD mode
Provider, it ends up as essentially the same thing.  You get the payload as
a Source (in some cases, a StaxSource so streaming can be maintained) and
all the soap stuff is not there.  If camel needs the whole message, the
Provider is put in MESSAGE mode.   

The benefit of the Provider/Dispatch stuff is that you DO get all the
complext WS-* processing and things like schema validation and other
important things that CXF provides, but you don't have to do all the code
generation and things like that.


Dan




Christian Schneider wrote:
 
 Hi all,
 
 I am thinking about how to make one way services easier. Currently I 
 generate code for the service using cxf codegen and use the camel-cxf 
 module to create a client or endpoint that can be routed over jms using 
 the camel-jms component. Using CXF for this task is a little overkill as 
 very few features of CXF are used and quite a lot of configuration has 
 to be done. I wonder if this can be done easier.
 
 I have experimented with a possible solution for the server part. It 
 looks like this:
 from(jms:myqueue).process(new 
 SoapProcessor(com.example.customerservice)).to(bean:serviceHandler);
 
 The idea is that a soap message for the service comes in over jms. The 
 soap processor parses the soap xml, strips the Envelope and Body and 
 unmarshals the content using JAXB. The processor needs the package name 
 of the generated stub code for the service. The advantage over using 
 camel-cxf is that there is much less configuration and you do not need 
 cxf at runtime (which means much less jars). Additionally the 
 serviceHandler bean only needs to have a method with the expected classs 
 type as input parameter it does not need to implement a service 
 interface. I have added the code of SoapProcessor to the mail as it is 
 quite small.
 
 So what do you think? Does it make sense to have such small scale SOAP 
 functionality in camel?
 I am thinking about turning my Processor into a DataFormat and provide 
 marshalling and unmarshalling. Does this make sense or is a processor 
 better?
 
 Greetings
 
 Christian
 
 -- 
 
 Christian Schneider
 ---
 http://www.liquid-reality.de
 
 
 
 
 import java.io.InputStream;
 import java.util.Iterator;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
 
 public class SoapProcessor implements Processor {
 
   private XPathExpression xpathExpression;
   private Unmarshaller unmarshaller;
 
   public SoapProcessor(String jaxbPackage) {
   super();
   XPath xpath = XPathFactory.newInstance().newXPath();
   xpath.setNamespaceContext(new SoapNameSpaceContext());
   try {
   xpathExpression = 
 xpath.compile(/soap:Envelope/soap:Body/*);
   JAXBContext jContext = 
 JAXBContext.newInstance(jaxbPackage);
   unmarshaller = jContext.createUnmarshaller();
   } catch (XPathExpressionException e) {
   throw new RuntimeException(e.getMessage(), e);
   } catch (JAXBException e) {
   throw new RuntimeException(e.getMessage(), e);
   }
   
   }
 
   private final class SoapNameSpaceContext implements NamespaceContext {
   private static final String SOAP_NAMESPACE =
 http://schemas.xmlsoap.org/soap/envelope/;;
 
   public Iterator?  getPrefixes(String namespaceURI) {
   return null;
   }
 
   public String getPrefix(String namespaceURI) {
   return null;
   }
 
   public String getNamespaceURI(String prefix) {
   return SOAP_NAMESPACE;
   }
   }
 
   public void process(Exchange exchange) throws Exception {
   InputStream request = 
 exchange.getIn().getBody(InputStream.class);
   InputSource is = new InputSource(request);
   Element payload = (Element) xpathExpression.evaluate(is,
 XPathConstants.NODE);
   JAXBElement?  el = (JAXBElement?) 
 unmarshaller.unmarshal(payload);
   Object o = el.getValue();
   exchange.getIn().setBody(o);
   }
 
 

Re: Easy One way soap services

2010-01-21 Thread William Tam
I could be wrong but I think when camel-cxf PAYLOAD mode was developed, 
the CXF Dispatch/Provider interface support wasn't quite ready (or we 
haven't done enough due diligence).   I agreed with you the benefit.  We 
could rewriting it using the Dispatch/Provider APIs.  However, I 
seriously doubt that we could integrate with CXF without directly 
invoking the non-APIs classes.  I mean that would be nice.  There is a 
soap component in camel-cxf which is pretty much not being used and that 
makes it look more complex then it really is.  A good chunk of the 
complexity are doing with header filtering, converting/binding Camel 
to CXF message, standard Camel Producer/Consumer/Endpoint/Spring which 
you need either way.  The CXF interceptor stuff which I agree we should 
avoid actually only accounts for small portion of the code (10 classes 
in org.apache.camel.component.cxf.intercepters and 2 of the 10 XML* are 
not used and two of them are Abstract classes).


Daniel Kulp wrote:

Quite honestly, I'm not sure why the CXF stuff in Camel has to be so
complex.   To me, it should be based more on the technology in CXF that
supports the JAX-WS Dispatch/Provider stuff (or implemented via the JAX-WS
Dispatch/Provider stuff).   In this case, if it was a PAYLOAD mode
Provider, it ends up as essentially the same thing.  You get the payload as
a Source (in some cases, a StaxSource so streaming can be maintained) and
all the soap stuff is not there.  If camel needs the whole message, the
Provider is put in MESSAGE mode.   


The benefit of the Provider/Dispatch stuff is that you DO get all the
complext WS-* processing and things like schema validation and other
important things that CXF provides, but you don't have to do all the code
generation and things like that.



Dan




Christian Schneider wrote:
  

Hi all,

I am thinking about how to make one way services easier. Currently I 
generate code for the service using cxf codegen and use the camel-cxf 
module to create a client or endpoint that can be routed over jms using 
the camel-jms component. Using CXF for this task is a little overkill as 
very few features of CXF are used and quite a lot of configuration has 
to be done. I wonder if this can be done easier.


I have experimented with a possible solution for the server part. It 
looks like this:
from(jms:myqueue).process(new 
SoapProcessor(com.example.customerservice)).to(bean:serviceHandler);


The idea is that a soap message for the service comes in over jms. The 
soap processor parses the soap xml, strips the Envelope and Body and 
unmarshals the content using JAXB. The processor needs the package name 
of the generated stub code for the service. The advantage over using 
camel-cxf is that there is much less configuration and you do not need 
cxf at runtime (which means much less jars). Additionally the 
serviceHandler bean only needs to have a method with the expected classs 
type as input parameter it does not need to implement a service 
interface. I have added the code of SoapProcessor to the mail as it is 
quite small.


So what do you think? Does it make sense to have such small scale SOAP 
functionality in camel?
I am thinking about turning my Processor into a DataFormat and provide 
marshalling and unmarshalling. Does this make sense or is a processor 
better?


Greetings

Christian

--

Christian Schneider
---
http://www.liquid-reality.de




import java.io.InputStream;
import java.util.Iterator;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;

public class SoapProcessor implements Processor {

private XPathExpression xpathExpression;
private Unmarshaller unmarshaller;

public SoapProcessor(String jaxbPackage) {
super();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(new SoapNameSpaceContext());
try {
xpathExpression = 
xpath.compile(/soap:Envelope/soap:Body/*);
JAXBContext jContext = 
JAXBContext.newInstance(jaxbPackage);
unmarshaller = jContext.createUnmarshaller();
} catch (XPathExpressionException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (JAXBException e) {
throw new RuntimeException(e.getMessage(), e);
}

}

private final class SoapNameSpaceContext implements NamespaceContext {

Re: FileConsumer move a file to wrong destination.

2010-01-21 Thread Claus Ibsen
Hi

Could you try with 2.2-SNAPSHOT ?

It is a bit odd since Camel should pickup .done as a relative directly
and not as a absolute filename.

You can also try to use
move=.done/${file:name}

Which should be what Camel translates .done to under the covers.



On Thu, Jan 21, 2010 at 5:08 PM, ariablu 962...@gmail.com wrote:

 using Apache Camel 2.1 and Spring,
 route: File - Processor - (cxf) - Log

 When ...
 /_work/test/from/1.txt

 if I run test case, 1.txt file was moved to
 /_work/test/from/.done (not directory!)

 But I want
 /_work/test/from/.done/1.txt

 
 [[test case]]
  camelContext xmlns=http://camel.apache.org/schema/spring;
   endpoint id=file1
 uri=file:C:\_work\test\from?delete=falseamp;noop=falseamp;move=.done/
   route
     from ref=file1/
     process ref=process1/
     !--  to uri=cxf  --
     to
 uri=log:testlog?level=INFOamp;showExchangeId=trueamp;showProperties=trueamp;showBodyType=trueamp;showBody=trueamp;showOut=trueamp;multiline=trueamp;showHeaders=true/
   /route
  /camelContext
  bean class=test.impl.Trans id=process1/
 
 [[test processor]]
 package test.impl;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 public class Trans implements Processor {
       public void process(Exchange exchange) throws Exception {
               exchange.getOut().setHeader(operationNameSpace,
 http://pc.ws;);
               exchange.getOut().setHeader(operationName, echo);
               exchange.getOut().setBody(new Object[]{A, B});
 }       }
 
 [[Log]]
 INFO testlog - Exchange[
 , Id:ffa13059-6465-4bb0-b9ca-8de545c50618
 ,
 Properties:{CamelToEndpoint=log://testlog?level=INFOmultiline=trueshowBody=trueshowBodyType=trueshowExchangeId=trueshowHeaders=trueshowOut=trueshowProperties=true,
 CamelBatchSize=1, CamelBatchComplete=true,
 CamelFileExchangeFile=GenericFile[C:\_work\test\from\1.txt],
 CamelBatchIndex=0}
 , Headers:{operationName=echo, operationNameSpace=http://pc.ws}
 , BodyType:Object[]
 , Body:[Ljava.lang.Object;@16be13b
 , Out: null]
 DEBUG GenericFileOnCompletion - Done processing file:
 GeneriacFile[C:\_work\test\from\1.txt] using exchange:
 Exchange[GenericFileMessage with body: [Ljava.lang.Object;@16be13b]
 DEBUG GenericFileRenameProcessStrategy - Renaming file:
 GenericFile[C:\_work\test\from\1.txt] to: GenericFile[\\.done]
 DEBUG FileUtil - Tried 1 to rename file: C:\_work\test\from\1.txt to:
 C:\_work\test\from\.done with result: true
 

 Thanks!
 --
 View this message in context: 
 http://old.nabble.com/FileConsumer-move-a-file-to-wrong-destination.-tp27260194p27260194.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


FTP Component - How to Disconnect?

2010-01-21 Thread Gunnar Hillert

Hi,

I am creating a simple flow uploading files using FTP and FTPs.

Here is the process definition:

I drop a file in a folder, Camel picks it up and uploads it to the 
server. Everything works perfectly.


My problem is that I would like to disconnect from the FTP server 
(terminate session) every time a file is uploaded. It seems though that 
the connection to the FTP server is kept open. Thus, if I drop a new 
file into my monitored folder the same FTP session is reused. I would 
like that not to happen.


How can I configure my camel process to disconnect from the FTP Server? 
I did not find any information on this.


Thanks a lot for your help!

Regards

Gunnar


Re: requestBodyAndHeader and HEADER_CLOSE_SESSION_WHEN_COMPLETE

2010-01-21 Thread Claus Ibsen
Debug the code :)

You should see this in the DEBUG log
LOG.debug(Closing session when complete);


On Thu, Jan 21, 2010 at 11:49 AM, huntc hu...@mac.com wrote:


 Claus Ibsen-2 wrote:

 Yes you need to pass in this header every time you want to session closed.


 I'm pretty convinced that this isn't happening for me despite passing in the
 header that I want the session closed when complete (which I presume is when
 I get a reply). Here's my log file:


 2010-01-21 15:57:59,406 [lCalendarEvents] DEBUG
 lendarEventAttendeeSMSNotifier - Sending message to xxx: Reply to confirm
 meeting closed Thu, 21 Jan '10 03:35PM Scen 7 # 7
 2010-01-21 15:57:59,409 [IoProcessor-1.2] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] CREATED
 2010-01-21 15:57:59,409 [IoProcessor-1.2] DEBUG ExecutorFilter
 - Launching thread for /192.168.0.200:9500
 2010-01-21 15:57:59,410 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] OPENED
 2010-01-21 15:57:59,410 [ MinaThreadPool] DEBUG ExecutorFilter
 - Exiting since queue is empty for /192.168.0.200:9500
 2010-01-21 15:57:59,410 [lCalendarEvents] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] WRITE:
 au.com.blueglue.bluegluesmsprotocol.send...@8e1a0d01
 2010-01-21 15:57:59,411 [IoProcessor-1.2] DEBUG ExecutorFilter
 - Launching thread for /192.168.0.200:9500
 2010-01-21 15:57:59,411 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] SENT:
 au.com.blueglue.bluegluesmsprotocol.send...@8e1a0d01
 2010-01-21 15:57:59,411 [ MinaThreadPool] DEBUG ExecutorFilter
 - Exiting since queue is empty for /192.168.0.200:9500
 2010-01-21 15:58:10,979 [IoProcessor-1.2] DEBUG ExecutorFilter
 - Launching thread for /192.168.0.200:9500
 2010-01-21 15:58:10,979 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] RECEIVED:
 au.com.blueglue.bluegluesmsprotocol.transmitted...@8e1a0d01
 2010-01-21 15:58:10,979 [ MinaThreadPool] DEBUG ExecutorFilter
 - Exiting since queue is empty for /192.168.0.200:9500
 2010-01-21 15:58:10,979 [lCalendarEvents] DEBUG
 lendarEventAttendeeSMSNotifier - Message sent
 2010-01-21 15:58:10,980 [lCalendarEvents] DEBUG
 lendarEventAttendeeSMSNotifier - Sending message to yyy: Reply to confirm
 meeting closed Thu, 21 Jan '10 03:35PM Scen 7 # 7
 2010-01-21 15:58:10,980 [lCalendarEvents] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] WRITE:
 au.com.blueglue.bluegluesmsprotocol.send...@808819c0
 2010-01-21 15:58:10,981 [IoProcessor-1.2] DEBUG ExecutorFilter
 - Launching thread for /192.168.0.200:9500
 2010-01-21 15:58:10,981 [ MinaThreadPool] INFO  MinaProducer$ResponseHandler
 - [/192.168.0.200:9500] SENT:
 au.com.blueglue.bluegluesmsprotocol.send...@808819c0
 2010-01-21 15:58:10,981 [ MinaThreadPool] DEBUG ExecutorFilter
 - Exiting since queue is empty for /192.168.0.200:9500
 2010-01-21 15:58:10,983 [IoProcessor-1.2] DEBUG ExecutorFilter
 - Launching thread for /192.168.0.200:9500
 ...


 After the received event at 2010-01-21 15:58:10,979, I was hoping that the
 socket would be closed. As you can see there is no trace in the log of the
 socket being closed.

 Is this a bug or am I not doing something quite right. Here's my code again:


 Object replyMessage = producerTemplate
    .requestBodyAndHeader(
        smsSenderEndpoint,
        requestMessage,
        MinaConsumer.HEADER_CLOSE_SESSION_WHEN_COMPLETE,
        true);


 The above template instance is called twice in succession as shown by the
 Sending message to entries.

 Thanks for your help.

 Kind regards,
 Christopher
 --
 View this message in context: 
 http://old.nabble.com/requestBodyAndHeader-and-HEADER_CLOSE_SESSION_WHEN_COMPLETE-tp27175565p27255912.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Easy One way soap services

2010-01-21 Thread William Tam
As another option, you can use the cxfbean compound but your bean
needs to have JAXWS annotations.


route
from 
uri=jetty:http://localhost:9090?matchOnUriPrefix=true; /
to uri=cxfbean:jaxwsBean /
/route


Please see the unit test here:
https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
(see testJaxWsBean)
https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml


The only catch is you will probably the first person to do
from(jms).to(cxfbean).


On Tue, Jan 19, 2010 at 4:53 PM, Christian Schneider
ch...@die-schneider.net wrote:
 Hi all,

 I am thinking about how to make one way services easier. Currently I
 generate code for the service using cxf codegen and use the camel-cxf module
 to create a client or endpoint that can be routed over jms using the
 camel-jms component. Using CXF for this task is a little overkill as very
 few features of CXF are used and quite a lot of configuration has to be
 done. I wonder if this can be done easier.

 I have experimented with a possible solution for the server part. It looks
 like this:
 from(jms:myqueue).process(new
 SoapProcessor(com.example.customerservice)).to(bean:serviceHandler);

 The idea is that a soap message for the service comes in over jms. The soap
 processor parses the soap xml, strips the Envelope and Body and unmarshals
 the content using JAXB. The processor needs the package name of the
 generated stub code for the service. The advantage over using camel-cxf is
 that there is much less configuration and you do not need cxf at runtime
 (which means much less jars). Additionally the serviceHandler bean only
 needs to have a method with the expected classs type as input parameter it
 does not need to implement a service interface. I have added the code of
 SoapProcessor to the mail as it is quite small.

 So what do you think? Does it make sense to have such small scale SOAP
 functionality in camel?
 I am thinking about turning my Processor into a DataFormat and provide
 marshalling and unmarshalling. Does this make sense or is a processor
 better?

 Greetings

 Christian

 --

 Christian Schneider
 ---
 http://www.liquid-reality.de

 


 import java.io.InputStream;
 import java.util.Iterator;

 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;

 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource;

 public class SoapProcessor implements Processor {

        private XPathExpression xpathExpression;
        private Unmarshaller unmarshaller;

        public SoapProcessor(String jaxbPackage) {
                super();
                XPath xpath = XPathFactory.newInstance().newXPath();
                xpath.setNamespaceContext(new SoapNameSpaceContext());
                try {
                        xpathExpression =
 xpath.compile(/soap:Envelope/soap:Body/*);
                        JAXBContext jContext =
 JAXBContext.newInstance(jaxbPackage);
                        unmarshaller = jContext.createUnmarshaller();
                } catch (XPathExpressionException e) {
                        throw new RuntimeException(e.getMessage(), e);
                } catch (JAXBException e) {
                        throw new RuntimeException(e.getMessage(), e);
                }

        }

        private final class SoapNameSpaceContext implements NamespaceContext
 {
                private static final String SOAP_NAMESPACE =
 http://schemas.xmlsoap.org/soap/envelope/;;

                public Iterator?  getPrefixes(String namespaceURI) {
                        return null;
                }

                public String getPrefix(String namespaceURI) {
                        return null;
                }

                public String getNamespaceURI(String prefix) {
                        return SOAP_NAMESPACE;
                }
        }

        public void process(Exchange exchange) throws Exception {
                InputStream request =
 exchange.getIn().getBody(InputStream.class);
                InputSource is = new InputSource(request);
                Element payload = (Element) xpathExpression.evaluate(is,
 XPathConstants.NODE);
                JAXBElement?  el = (JAXBElement?)
 unmarshaller.unmarshal(payload);
                Object o = el.getValue();
                exchange.getIn().setBody(o);
        }

 }




Re: FTP Component - How to Disconnect?

2010-01-21 Thread Christian Müller
Hey Gunnar,

you are right. At present, we disconnect only after a failed write/upload
from the server. Currently you have no choice to configure a session
disconnect after a write.

@Claus: Should Gunnar open a JIRA ticket for that or won't we change this?

Regards,
Christian

On Thu, Jan 21, 2010 at 6:46 PM, Gunnar Hillert gun...@hillert.com wrote:

 Hi,

 I am creating a simple flow uploading files using FTP and FTPs.

 Here is the process definition:

 I drop a file in a folder, Camel picks it up and uploads it to the server.
 Everything works perfectly.

 My problem is that I would like to disconnect from the FTP server
 (terminate session) every time a file is uploaded. It seems though that the
 connection to the FTP server is kept open. Thus, if I drop a new file into
 my monitored folder the same FTP session is reused. I would like that not to
 happen.

 How can I configure my camel process to disconnect from the FTP Server? I
 did not find any information on this.

 Thanks a lot for your help!

 Regards

 Gunnar



Re: Easy One way soap services

2010-01-21 Thread Willem Jiang

Hi Dan,

What we do in camel-cxf is try to reuse everything what CXF can provide.
First we use the cxf-simple-front and cxf-jaxws-front endpoint to export 
or consumer the WS services, then we provides MESSAGE, and PAYLOAD 
DataFormat by massage the interceptors ourself, then we have cxfBeans, 
cxfrs components.


We could avoid to tough CXF internal API by leveraging the JAX-WS 
Dispatch/Provider API, but we still need to support other features of CXF.


Willem

Daniel Kulp wrote:


Quite honestly, I'm not sure why the CXF stuff in Camel has to be so
complex.   To me, it should be based more on the technology in CXF that
supports the JAX-WS Dispatch/Provider stuff (or implemented via the JAX-WS
Dispatch/Provider stuff).   In this case, if it was a PAYLOAD mode
Provider, it ends up as essentially the same thing.  You get the payload as
a Source (in some cases, a StaxSource so streaming can be maintained) and
all the soap stuff is not there.  If camel needs the whole message, the
Provider is put in MESSAGE mode.   


The benefit of the Provider/Dispatch stuff is that you DO get all the
complext WS-* processing and things like schema validation and other
important things that CXF provides, but you don't have to do all the code
generation and things like that.



Dan




Christian Schneider wrote:

Hi all,

I am thinking about how to make one way services easier. Currently I 
generate code for the service using cxf codegen and use the camel-cxf 
module to create a client or endpoint that can be routed over jms using 
the camel-jms component. Using CXF for this task is a little overkill as 
very few features of CXF are used and quite a lot of configuration has 
to be done. I wonder if this can be done easier.


I have experimented with a possible solution for the server part. It 
looks like this:
from(jms:myqueue).process(new 
SoapProcessor(com.example.customerservice)).to(bean:serviceHandler);


The idea is that a soap message for the service comes in over jms. The 
soap processor parses the soap xml, strips the Envelope and Body and 
unmarshals the content using JAXB. The processor needs the package name 
of the generated stub code for the service. The advantage over using 
camel-cxf is that there is much less configuration and you do not need 
cxf at runtime (which means much less jars). Additionally the 
serviceHandler bean only needs to have a method with the expected classs 
type as input parameter it does not need to implement a service 
interface. I have added the code of SoapProcessor to the mail as it is 
quite small.


So what do you think? Does it make sense to have such small scale SOAP 
functionality in camel?
I am thinking about turning my Processor into a DataFormat and provide 
marshalling and unmarshalling. Does this make sense or is a processor 
better?


Greetings

Christian

--

Christian Schneider
---
http://www.liquid-reality.de




import java.io.InputStream;
import java.util.Iterator;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;

public class SoapProcessor implements Processor {

private XPathExpression xpathExpression;
private Unmarshaller unmarshaller;

public SoapProcessor(String jaxbPackage) {
super();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(new SoapNameSpaceContext());
try {
xpathExpression = 
xpath.compile(/soap:Envelope/soap:Body/*);
JAXBContext jContext = 
JAXBContext.newInstance(jaxbPackage);
unmarshaller = jContext.createUnmarshaller();
} catch (XPathExpressionException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (JAXBException e) {
throw new RuntimeException(e.getMessage(), e);
}

}

private final class SoapNameSpaceContext implements NamespaceContext {
private static final String SOAP_NAMESPACE =
http://schemas.xmlsoap.org/soap/envelope/;;

public Iterator?  getPrefixes(String namespaceURI) {
return null;
}

public String getPrefix(String namespaceURI) {
return null;
}

public String getNamespaceURI(String prefix) {
return SOAP_NAMESPACE;
}
}

public void process(Exchange 

camel-spring:test-jar missing from snapshot releases?

2010-01-21 Thread tide08

I upgraded to camel 2.2-SNAPSHOT and my project fails to compile as it looks
like camel-spring:tests-jar is missing? All the other components downloaded
fine, I did lookup in camel snapshot repository and did not find specified
jar there as well.

Here is mvn error stack trace:

[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

Missing:
--
1) org.apache.camel:camel-spring:test-jar:tests:2.2-SNAPSHOT

  Try downloading the file manually from the project website.


-- 
View this message in context: 
http://old.nabble.com/camel-spring%3Atest-jar-missing-from-snapshot-releases--tp27266465p27266465.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Camel 1.6.x vs 2.x performance comparisons?

2010-01-21 Thread tide08

Hi,

I was looking for some performance metrices on how camel 1.6.x performs vs
2.x? Since there are lot of platform improvements in camel 2.x, how does it
fair as compared to 1.6.x?

I upgraded my app recently and my app and load test is showing degraded
results and only change being upgrade to camel 2.1.0. So I was just
wondering, if there are results showing that 2.x is better than 1.6.x, I can
divulge more into hardware and OS stats on my side.

Thanks!
-- 
View this message in context: 
http://old.nabble.com/Camel-1.6.x-vs-2.x-performance-comparisons--tp27266469p27266469.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: FTP Component - How to Disconnect?

2010-01-21 Thread Stan Lewis
My 2 cents is that it's a worthwhile option to have, many FTP servers
would close the connection on you after a timeout anyway.

On Thu, Jan 21, 2010 at 4:02 PM, Christian Müller
christian.muel...@gmail.com wrote:
 Hey Gunnar,

 you are right. At present, we disconnect only after a failed write/upload
 from the server. Currently you have no choice to configure a session
 disconnect after a write.

 @Claus: Should Gunnar open a JIRA ticket for that or won't we change this?

 Regards,
 Christian

 On Thu, Jan 21, 2010 at 6:46 PM, Gunnar Hillert gun...@hillert.com wrote:

 Hi,

 I am creating a simple flow uploading files using FTP and FTPs.

 Here is the process definition:

 I drop a file in a folder, Camel picks it up and uploads it to the server.
 Everything works perfectly.

 My problem is that I would like to disconnect from the FTP server
 (terminate session) every time a file is uploaded. It seems though that the
 connection to the FTP server is kept open. Thus, if I drop a new file into
 my monitored folder the same FTP session is reused. I would like that not to
 happen.

 How can I configure my camel process to disconnect from the FTP Server? I
 did not find any information on this.

 Thanks a lot for your help!

 Regards

 Gunnar




Re: Camel 1.6.x vs 2.x performance comparisons?

2010-01-21 Thread Willem Jiang

Hi,

Clause did some performance enhancement in Camel 2.x.
Here is the wiki page[1].

Can you show us your camel route ? That could be helpful for us to dig 
the issue.


Willem

tide08 wrote:

Hi,

I was looking for some performance metrices on how camel 1.6.x performs vs
2.x? Since there are lot of platform improvements in camel 2.x, how does it
fair as compared to 1.6.x?

I upgraded my app recently and my app and load test is showing degraded
results and only change being upgrade to camel 2.1.0. So I was just
wondering, if there are results showing that 2.x is better than 1.6.x, I can
divulge more into hardware and OS stats on my side.

Thanks!




Re: camel-spring:test-jar missing from snapshot releases?

2010-01-21 Thread Willem Jiang
I think you can avoid to use the camel-spring:tests-jar by using 
camel-test.jar in your test.
We introduced camel-test module in camel 2.x to avoid user's test 
dependency on the tests-jar.


Willem

tide08 wrote:

I upgraded to camel 2.2-SNAPSHOT and my project fails to compile as it looks
like camel-spring:tests-jar is missing? All the other components downloaded
fine, I did lookup in camel snapshot repository and did not find specified
jar there as well.

Here is mvn error stack trace:

[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

Missing:
--
1) org.apache.camel:camel-spring:test-jar:tests:2.2-SNAPSHOT

  Try downloading the file manually from the project website.






Re: FTP Component - How to Disconnect?

2010-01-21 Thread Claus Ibsen
On Thu, Jan 21, 2010 at 10:02 PM, Christian Müller
christian.muel...@gmail.com wrote:
 Hey Gunnar,

 you are right. At present, we disconnect only after a failed write/upload
 from the server. Currently you have no choice to configure a session
 disconnect after a write.

 @Claus: Should Gunnar open a JIRA ticket for that or won't we change this?


+1 to open a ticket in JIRA.


 Regards,
 Christian

 On Thu, Jan 21, 2010 at 6:46 PM, Gunnar Hillert gun...@hillert.com wrote:

 Hi,

 I am creating a simple flow uploading files using FTP and FTPs.

 Here is the process definition:

 I drop a file in a folder, Camel picks it up and uploads it to the server.
 Everything works perfectly.

 My problem is that I would like to disconnect from the FTP server
 (terminate session) every time a file is uploaded. It seems though that the
 connection to the FTP server is kept open. Thus, if I drop a new file into
 my monitored folder the same FTP session is reused. I would like that not to
 happen.

 How can I configure my camel process to disconnect from the FTP Server? I
 did not find any information on this.

 Thanks a lot for your help!

 Regards

 Gunnar





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: FTP Component - How to Disconnect?

2010-01-21 Thread Claus Ibsen
Hi

I have created the ticket
https://issues.apache.org/activemq/browse/CAMEL-2391

And also implemented this new feature.

There is a new option disconnect=true which will disconnect from the
remote ftp server right after use.
It can be used on both the consumer or producer side.

Will be in the next Camel 2.2 release, which is due next month.

On Fri, Jan 22, 2010 at 6:23 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Thu, Jan 21, 2010 at 10:02 PM, Christian Müller
 christian.muel...@gmail.com wrote:
 Hey Gunnar,

 you are right. At present, we disconnect only after a failed write/upload
 from the server. Currently you have no choice to configure a session
 disconnect after a write.

 @Claus: Should Gunnar open a JIRA ticket for that or won't we change this?


 +1 to open a ticket in JIRA.


 Regards,
 Christian

 On Thu, Jan 21, 2010 at 6:46 PM, Gunnar Hillert gun...@hillert.com wrote:

 Hi,

 I am creating a simple flow uploading files using FTP and FTPs.

 Here is the process definition:

 I drop a file in a folder, Camel picks it up and uploads it to the server.
 Everything works perfectly.

 My problem is that I would like to disconnect from the FTP server
 (terminate session) every time a file is uploaded. It seems though that the
 connection to the FTP server is kept open. Thus, if I drop a new file into
 my monitored folder the same FTP session is reused. I would like that not to
 happen.

 How can I configure my camel process to disconnect from the FTP Server? I
 did not find any information on this.

 Thanks a lot for your help!

 Regards

 Gunnar





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus




-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus