I may have discovered my issue

I decided to print the filename to the ActiveMQ log file to see if I am pulling 
the information out.

When the information prints I can see the filename is not being retrieved from 
the message details, the entry in the log file prints the following:

    File name = $myFIleName

Does anyone have a suggestion on the entry I need in order to read the 
filename= from the message details?


Jason

________________________________
From: Jason Jackson <[email protected]>
Sent: Tuesday, February 24, 2026 3:13 PM
To: [email protected] <[email protected]>
Subject: ActiveMQ Binary Message and SFTP Transfer

I have an application that is sending a pure binary file to an ActiveMQ queue.

The message details of the binary file contains information related to the 
file.  One component in the message details is the following:

    filename=myfile.txt

Using the embedded Camel functionality and capabilities of ActiveMQ I am 
performing the following actions.

    This is valid and ActiveMQ loads without any issues

    <setVariable name="myFileName">
        <simple>${bodyAs(String)} 
regex('(?s).*filename=([a-zA-Z0-9_\-\.]+).*')</simple>
    </setVariable>


My uri is the following

    <to 
uri="sftp://username@ip/dir?password=myPassword&amp;autoCreate=true&amp;binary=true&amp;passiveMode=true&ampknownHostsFile=/myHostFile&amp;fileName=${myFileName}"/>

As soon as I add fileName=${myFileName} to the URI, ActiveMQ throws an error 
and fails to load.  An example of the error is:

Exception encountered during context initialization - cancelling refresh 
attempt: org.apache.camel.FailedToCreateRouteException: Failed to create route: 
QUEUE1 at: >>> 
To[sftp://username@ip/dir?password=xxxxxx&autoCreate=true&binary=true&passiveMode=true&knownHostsFile=/myHostFile&fileName=${myFileName}]
 <<< in route: Route(QUEUE1)[From[jms:queue://QUEUE1... because: Failed to 
resolve endpoint: 
sftp://username@ip/dir?autoCreate=true&binary=true&fileName=myFileName&knownHostsFile=/myHostFile&passiveMode=true&password=xxxxxx
 due to: Error binding property (fileName=${myFileName}) with name: fileName on 
bean: 
sftp://username@ip/dir?autoCreate=true&binary=true&fileName=myFileName&knownHostsFile=/myHostFile&passiveMode=true&password=xxxxxx
 with value: ${myFileName} | org.apache.activemq.xbean.XBeanBrokerFactory$1 | 
main

If I do not attempt to set the filename and just send the file over it connects 
via sftp and the file transfers without any issues, the issue is I need to set 
the file name to what is in the message details.

I have attempted to load the uri using the toD dynamic option and it fails 
also.  This error states it failed with an excepting and just provides a print 
out of the uri I am attempting to connect to.

I used the following link, 
https://camel.apache.org/components/4.14.x/sftp-component.html#_usage, for the 
Camel commands/settings.

Does anyone have a suggestion on what I may be doping wrong or if there is an 
additional entry/setting that I need?

Jason

Reply via email to