I should have provided that and was not thinking. I am using the Camel version that is embedded with ActiveMQ 6.2.1 which is 4.14.4
Jason ________________________________ From: Claus Ibsen <[email protected]> Sent: Saturday, February 28, 2026 10:49 AM To: [email protected] <[email protected]> Subject: Re: Camel and ActiveMQ SFTP Data Transfers in Raw Binary Format CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Hi What version of Apache Camel are you using? On Sat, Feb 28, 2026 at 4:33 PM Jason Jackson <[email protected]> wrote: > I am receiving data within ActiveMQ on QUEUE_1, the data that arrives on > the queue is in a raw binary format. The data is being retrieved from > ActiveMQ using a Camel route and transmitted to an alternate location using > SFTP. If the data is modified in any way the destination location will > reject the data. When the Data is retrieved from ActiveMQ and sent via > SFTP there is a slight files size difference and data does not appear to be > in the exact format. > > After my initial testing I discovered I was possibly missing one setting > on the from uri line, I added jmsMessageType=Bytes to force JMS to know the > file is in binary format. > > My example Camel rout I am using is below. > > <beans > > xmlns="https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247675452%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=tWBljbn7OS5RrLkamSDLTsZi7wyc1mHwjUNLJBOW4Eg%3D&reserved=0<http://www.springframework.org/schema/beans>" > > xmlns:xsi="https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247706146%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=UCjTXrY0T5i8SHXV5wUG3mDwyWD7M%2BcXkUCVQ6UpQio%3D&reserved=0<http://www.w3.org/2001/XMLSchema-instance>" > > xsi:schemaLocation="https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247720314%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ZoF9Ol9%2B0bo%2BDZGRaVXKhivgFl294mmxuBThWQIKYBU%3D&reserved=0 > https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring%2Fcamel-spring.xsd&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247739905%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=pf%2FNaReReTFYQw0w2bf%2B3GciaR2kfTpvD%2BUWCzFHAd4%3D&reserved=0<http://camel.apache.org/schema/spring/camel-spring.xsd> > https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247755766%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=T655srDLYvEooTrJf7DZjjUjIyqI9h7mmt7tfzo9zQc%3D&reserved=0<http://www.springframework.org/schema/beans> > https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans%2Fspring-beans.xsd&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247773781%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=YabFzSlDYPwdWZxnmX3GfMbfkDPxJ031CQYYwu%2B4pSQ%3D&reserved=0"><http://www.springframework.org/schema/beans/spring-beans.xsd> > > <camelContext id="camel" > xmlns="https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring&data=05%7C02%7Cjason.jackson%40itechag.com%7C2c43cb13ce3043845f2008de76e113b7%7C07e5f1b9902a4d9f974c04601319bfec%7C0%7C0%7C639078906247791694%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=CtUcnmJpVj86xyBxprlMZpJbCdi%2F3vWaDNW0ovJnIZc%3D&reserved=0<http://camel.apache.org/schema/spring>" > streamCache="true"> > <route id="QUEUE_1"> > <from > uri="jms:queue://QUEUE_1?jmsMessageType=Bytes&cacheLevelName=CACHE_CONSUMER&concurrentConsumers=4&maxConcurrentConsumers=10&maxMessagesPerTask=200&transacted=true&lazyCreateTransactionManager=false&acknowledgementModeName=CLIENT_ACKNOWLEDGE&connectionFactory=#broker1"/> > <setProperty name="sftpFileName"> > <simple>${header.JMSCorrelationID}</simple> > </setProperty> > <!-- > <convertBodyTo type="java.io.InputStream"/> > <convertBodyTo type="byte[]"/> > <convertBodyTo type="java.lang.Byte[]"/> > --> > <to uri="sftp://user@ip > /dir?password=myPassword&autoCreate=true&binary=true&passiveMode=true&knownHostsFile=/dir/hosts&fileName=${exchangeProperty.sftpFileName}"/> > </route> > </camelContext> > </beans> > > > I am not sure if any additional transformations or settings are required > in or to retrieve the file from ActiveMQ and send it via SFTP in pure raw > binary format. > > I attempted to set/use the lines that are commented out but receive > additional errors in my log file, those errors are below. > > > Caused by: org.apache.camel.InvalidPayloadException: No body available of > type: java.io.InputStream but has type: java.lang.Byte[] on: > Message[ID:broker_1]. Caused by: No type converter available to convert > from type: java.lang.Byte[] to the required type: java.io.InputStream. > Exchange[]. Caused by: [org.apache.camel.NoTypeConversionAvailableException > - No type converter available to convert from type: java.lang.Byte[] to the > required type: java.io.InputStream] > > Caused by: org.apache.camel.NoTypeConversionAvailableException: No type > converter available to convert from type: java.lang.Byte[] to the required > type: java.io.InputStream > > Execution of JMS message listener failed. Caused by: > [org.apache.camel.component.file.GenericFileOperationFailedException - > Cannot store file: dir/file.name] | > org.apache.camel.component.jms.EndpointMessageListener | Camel (camel) > thread #2 - JmsConsumer[QUEUE_1] > > Caused by: org.apache.camel.InvalidPayloadException: No body available of > type: java.io.InputStream but has type: java.lang.Byte[] on: > Message[ID:broker_1]. Caused by: No type converter available to convert > from type: java.lang.Byte[] to the required type: java.io.InputStream. > Exchange[]. Caused by: [org.apache.camel.NoTypeConversionAvailableException > - No type converter available to convert from type: java.lang.Byte[] to the > required type: java.io.InputStream] > > Caused by: org.apache.camel.NoTypeConversionAvailableException: No type > converter available to convert from type: java.lang.Byte[] to the required > type: java.io.InputStream > > > Does the example route above appear correct or should some additional > settings/conversions be added > > > > Jason > -- Claus Ibsen
