Re: basic question about where aggregation is appropriate

2024-01-18 Thread Mitch Trachtenberg
Claus,

Thank you!  It wasn't obvious to me how straightforward it is to convert
Strings to other property types in YAML/XML.  Your response has simplified
my life (and route) enormously.

Thanks again,
Mitch

On Thu, Jan 18, 2024 at 2:11 AM Claus Ibsen  wrote:

> Hi
>
> Is each field name unique, and in the form
>
> key1=value1
> key2=value2
>
> You can then load this into a java.util.Properties (that is a Map) then you
> set that as a header.
>
>
>
> On Wed, Jan 10, 2024 at 4:54 PM Mitch Trachtenberg 
> wrote:
>
> > Hi,
> >
> > I am using the following approach in designing an application, but I am
> not
> > sure whether this is the appropriate way of handling things.  Any advice
> > appreciated.
> >
> > I have a String body with multiple lines, each line containing a field
> name
> > and value.
> >
> > To use parameters in the SQL, I want to set headers in Camel.  I use
> split
> > and aggregate to send one line at a time to a route which sets a header,
> > and in the aggregation, I merge the headers.  This allows me to then
> issue
> > a SQL call in YAML using the :#${header.x} syntax for multiple fields.
> >
> > While this works, I am suspicious that I'm taking a long way around and
> > there is a more straightforward approach.  I'm assuming that I need the
> > values in headers in order to send them in as parameters to a prepared
> > statement to bypass the possibility of SQL injection.
> >
> > Am I missing a more straightforward approach, or is this how it's
> typically
> > done?
> >
> > Thanks,
> > Mitch
> >
>
>
> --
> Claus Ibsen
> -
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: basic question about where aggregation is appropriate

2024-01-18 Thread Claus Ibsen
Hi

Is each field name unique, and in the form

key1=value1
key2=value2

You can then load this into a java.util.Properties (that is a Map) then you
set that as a header.



On Wed, Jan 10, 2024 at 4:54 PM Mitch Trachtenberg  wrote:

> Hi,
>
> I am using the following approach in designing an application, but I am not
> sure whether this is the appropriate way of handling things.  Any advice
> appreciated.
>
> I have a String body with multiple lines, each line containing a field name
> and value.
>
> To use parameters in the SQL, I want to set headers in Camel.  I use split
> and aggregate to send one line at a time to a route which sets a header,
> and in the aggregation, I merge the headers.  This allows me to then issue
> a SQL call in YAML using the :#${header.x} syntax for multiple fields.
>
> While this works, I am suspicious that I'm taking a long way around and
> there is a more straightforward approach.  I'm assuming that I need the
> values in headers in order to send them in as parameters to a prepared
> statement to bypass the possibility of SQL injection.
>
> Am I missing a more straightforward approach, or is this how it's typically
> done?
>
> Thanks,
> Mitch
>


-- 
Claus Ibsen
-
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2