Camel Quarkus encrypted property values with Jasypt - apache-camel

I'm investigating migrating our Camel 2.x integrations to Camel-Quarkus.
Currently, we use Jasypt to encrypt sensitive property values, such as passwords.
We define the JasyptPropertiesParser and property-placeholder in blueprint xml like this:
https://camel.apache.org/components/3.18.x/others/jasypt.html#_example_with_blueprint_xml
How can we do this in Camel-Quarkus?
The camel-quarkus-jasypt component is available, but I don't know how to use it.
https://camel.apache.org/camel-quarkus/2.11.x/reference/extensions/jasypt.html
Thanks

Related

Apache camel - How to retrieve Endpoint URIs for a given Component

I use Apache Camel 2.20x.
A camel component can be developed with a uri scheme for example "sample-component". Now the Endpoint of this component can actually extend an existing Endpoint say SQL which has uri syntax as "sql:<select query">.
Now I am listening to camel Exchange event (ExchangeSentEvent) When I retrive the uri from the event I get "sql:<select query">. But what I want is to get "sample-component". How can we achieve that. In simple terms following is the ask
How can we get all Endpoint uri schemes for a camel component.
Thanks in advance
Gk
ComponentName+Endpoint . You can see all the uri that the component will take. All camel components are named this way.There may be exceptions. also if u use intellij idea apache camel plugin it show .
examples
HttpEndpoint
TimerEndpoint
SedaEndpoint
DirectEndpoint
You can also find the consumer and producer classes of these components as follows.
HtppProducer if support HttpConsumer ..

How to configure Karaf org.ops4j.pax.logging.cfg to use a sift appender based on the log4j2 logging category

I'm using Karaf and Camel and have been able to configure PAX logging to sift on MDC fields (camel.routeId) and that works just fine.
I'm wondering if I can configure log4j2 to sift on the logging category field (%c or %logger in log4j2 conversion pattern terms) or if anyone can point me in the right direction as to how I could go about configuring it.
Log4j2 (pax-logging-log4j2) is "sifting" on the basis of MDC data. By default logger/category is not part of this context data. You can however put the logger name to MDC yourself.
In pax-logging-log4j2, org.ops4j.pax.logging.log4j2.internal.PaxLoggerImpl#setDelegateContext() method sets 3 keys:
bundle.id
bundle.name
bundle.version
Camel sets own keys (like context-id) in org.apache.camel.impl.MDCUnitOfWork constructor.

Difference between CamelContext and Registry in Camel

I'm new to Camel and bit confused between CamelContext and Registry.
As far as I know that CamelContext is the base object like ApplicationContext in Spring that is used for add routes and maintains the camel life cycle.
Also we got the Registry object from CamelContext but not sure what is the main purpose of this registry.
My intention is to add the component in the context/registry so that JNDIBind can look up the components.
CamelContext: Kind of Camel Runtime that keeps everything in Camel together, e.g.: Endpoints, TypeConverter, Routes, Components and Registry(!).
Registry: allows you to lookup beans, which by default will be JNDI beans. If you use the spring integration it will be Spring's ApplicationContext.
Generally camel when used with spring makes use of the ApplicationContextRegistry to lookup components, endpoints etc with the name of the bean defined in spring-bean.xml file. In places where we need to use JNDIRegistry we would have to add that registry when creating the CamelContext. This is used in places where JNDI objects are shared accross multiple JVMs where JNDI is the best solution.
Please see different types of registry implementation for camel: camel registries

how to migrate ftp route from xml to java

i began to refactor/ rebuild a xml based camel project to a java based one (i need to strictly separate configuration from functional stuff).
i am new to camel and so i am stumbling over the very first route, a ftp route. The ftp url and credentials are configuration but all the rest should be set in java.
at the moment the urie looks as follows:
ftp://<fromConfig>&stepwise=true&delay=1000&move=${file:name}.trans&recursive=true&binary=true&filter=#doneFilter&maxMessagesPerPoll=200&eagerMaxMessagesPerPoll=false&sorter=#pcrfSorter
So how to do this in java. especially the stuff using beans with "#".
thx in advance
The uri is the same in Java or XML DSL. Only that in XML mind you need to XML escape the & so it becomes & etc.
The # is a lookup in the registry, see more here: http://camel.apache.org/how-do-i-configure-endpoints.html
So the lookup happens in the Camel registry which can be a facade for JDNI / Spring etc. So it depends in what container you run Camel.
You can find a bit more details about Camel registry at: https://camel.apache.org/registry.html

How do I obscure a password in a Camel configuration file

I am looking at using the Camel crypto tool for processing PGP data but have a requirement that the password to the keys used be either encrypted in the configuration file or be sourced from a secure server elsewhere. Is this possible without generating my own PGP processor?
Yes see the security menu on the Apache Camel web site: http://camel.apache.org/security.html
There is a section about configuration security, where you can use camel-jasypt for that: http://camel.apache.org/jasypt.html
This allows you to store encrypted usernames / passwords etc in a .properties file, and then you can refer to these properties from Camel crypto, using Camel's property placeholder: http://camel.apache.org/using-propertyplaceholder.html

Resources