Bindy plus Unicode

2020-01-24 Thread Michael Greulich
Hi, 

I’m having problems with the bindy component and wonder if there is something I 
missed. Maybe one can help me addressing it. I cannot believe, that I’m the 
first to hit this problem.

I need to port an EAI application built using bindy, that reads a fixed type 
file(*) converts it and sends the data somewhere else. Currently this file is 
in Latin 1 encoding, but we need to take it to Unicode – effectively UTF-8. We 
have an ugly, but effectively unavoidable legacy application that creates the 
file. 

Unicode is a bit tricky, when it comes to counting the length of a string 
specially since Java uses internally UTF-16, which means depending on the 
codepoint 1 – 2 (Java-)chars. Bindy seems to use internally for selection 
substring and counts chars like Java does. This means the length of a string is 
the count of the chars, i.e. UTF-16 surrogates, but not codepoints, which is 
the common denominator (e.g. see definition of string length in XMLSchema). And 
when one takes combing chars into account (one “base char” plus 0 – n combining 
chars are perceived as one “char” by users) it becomes even more of a problem. 

Is there a possibility to tell bindy how it counts an and selects the tokens 
based on char counts in a given line? Any suggestions? Is the are related bug 
or change to come that addresses this problem?

-- Mik 

(*) This means, that on certain positions there start certain data (columns if 
you will).



RE: Is it possible to have several rest configurations in rest dsl, for example with http and https schemes on different ports?

2020-01-24 Thread Riaan Annandale
Hi Mikhail

For what it's worth, I asked a similar question before. Part of my REST config:
if (Boolean.parseBoolean(System.getenv("authDisabled"))) {
endpointProperty = "myLog";
} else endpointProperty = "myLog, sessionHandler";

restConfiguration()
.component("jetty")
.endpointProperty("handlers", endpointProperty)

sessionHandler is an object that contains my integration into Keycloak for 
OAUTH2 things

My use case was that I'd like to run a 2nd rest config on a different port 
(which will be unsecured) so that I can put a 2nd instance of my rest endpoints 
behind an API gateway. Unfortunately I received no response, so my solution was 
to run two instances of my camel code. I am fortunate enough to be able to do 
that because I don't keep state inside camel but rather in things like mongodb/ 
postgresql.

Unless someone pipes up to let us know how to run multiple rest configs, I 
suggest looking at a solution like mine

Riaan

-Original Message-
From: Mikhail Lukyanov  
Sent: Friday, 24 January 2020 09:52
To: users@camel.apache.org
Subject: Is it possible to have several rest configurations in rest dsl, for 
example with http and https schemes on different ports?

I hava one rest config for http scheme, but I need several configurations, for 
example, for https scheme to on different port. I use 2.20.2 camel-version. My 
config

*-http://camel.apache.org/schema/spring
" id="rest">*
*   -*
*   *
**
*   -*
*   -*
*   *
*   *
**
**


Re: Bindy plus Unicode

2020-01-24 Thread Alex Dettinger
Hi Michael,

I was just looking at this component for another purpose and it looks
to me that fixed length tokenzation occurs here:

https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java#L212..L216
  So, It counts in java chars and not code points. You can maybe experiment
injecting a custom BindyFixedLengthFactory, via
dataFormat.setModelFactory(..).

  Would you feel that an extension point to customize count/selection of
chars/codepoint/grapheme would be valuable to the community, feel free to
raise a JIRA ticket.

Alex


On Fri, Jan 24, 2020 at 9:52 AM Michael Greulich 
wrote:

> Hi,
>
> I’m having problems with the bindy component and wonder if there is
> something I missed. Maybe one can help me addressing it. I cannot believe,
> that I’m the first to hit this problem.
>
> I need to port an EAI application built using bindy, that reads a fixed
> type file(*) converts it and sends the data somewhere else. Currently this
> file is in Latin 1 encoding, but we need to take it to Unicode –
> effectively UTF-8. We have an ugly, but effectively unavoidable legacy
> application that creates the file.
>
> Unicode is a bit tricky, when it comes to counting the length of a string
> specially since Java uses internally UTF-16, which means depending on the
> codepoint 1 – 2 (Java-)chars. Bindy seems to use internally for selection
> substring and counts chars like Java does. This means the length of a
> string is the count of the chars, i.e. UTF-16 surrogates, but not
> codepoints, which is the common denominator (e.g. see definition of string
> length in XMLSchema). And when one takes combing chars into account (one
> “base char” plus 0 – n combining chars are perceived as one “char” by
> users) it becomes even more of a problem.
>
> Is there a possibility to tell bindy how it counts an and selects the
> tokens based on char counts in a given line? Any suggestions? Is the are
> related bug or change to come that addresses this problem?
>
> -- Mik
>
> (*) This means, that on certain positions there start certain data
> (columns if you will).
>
>


SNMP Component configuration problems

2020-01-24 Thread Lederer.Stefan
Hi,

currently I am working on a project where I receive OPC UA data and send them 
via SNMP to a PRTG monitoring system. I already created the routes between OPC 
UA datapoints and a SNMP client (with an unique OID). The problem here is the 
connection to the PRTG monitoring system. When I try to connect to the system I 
just receive a timeout exception. I monitored the messages via wireshark and 
got just requests form both sides. It seems that the camle snmp component waits 
for a response from the prtg monitor.

Is there any way to configure the camel route, so it just sends the data 
without checking for the monitoring system?

Stefan


Re: SNMP Component configuration problems

2020-01-24 Thread Andrea Cosentino
Please always add information about the version you're using

Il ven 24 gen 2020, 12:32  ha scritto:

> Hi,
>
> currently I am working on a project where I receive OPC UA data and send
> them via SNMP to a PRTG monitoring system. I already created the routes
> between OPC UA datapoints and a SNMP client (with an unique OID). The
> problem here is the connection to the PRTG monitoring system. When I try to
> connect to the system I just receive a timeout exception. I monitored the
> messages via wireshark and got just requests form both sides. It seems that
> the camle snmp component waits for a response from the prtg monitor.
>
> Is there any way to configure the camel route, so it just sends the data
> without checking for the monitoring system?
>
> Stefan
>


AW: SNMP Component configuration problems

2020-01-24 Thread Lederer.Stefan
I'm using version 2.24.2

-Ursprüngliche Nachricht-
Von: Andrea Cosentino  
Gesendet: Freitag, 24. Januar 2020 12:40
An: users@camel.apache.org
Betreff: Re: SNMP Component configuration problems

Please always add information about the version you're using

Il ven 24 gen 2020, 12:32  ha scritto:

> Hi,
>
> currently I am working on a project where I receive OPC UA data and 
> send them via SNMP to a PRTG monitoring system. I already created the 
> routes between OPC UA datapoints and a SNMP client (with an unique 
> OID). The problem here is the connection to the PRTG monitoring 
> system. When I try to connect to the system I just receive a timeout 
> exception. I monitored the messages via wireshark and got just 
> requests form both sides. It seems that the camle snmp component waits for a 
> response from the prtg monitor.
>
> Is there any way to configure the camel route, so it just sends the 
> data without checking for the monitoring system?
>
> Stefan
>


Re: Is it possible to have several rest configurations in rest dsl, for example with http and https schemes on different ports?

2020-01-24 Thread Mikhail Lukyanov
Hi Riaan

Thanks for the information, I came up with an option with several
camelCcontexts, then I can have several configs on different ports

http://camel.apache.org/schema/spring";>






test path

Get method




http://camel.apache.org/schema/spring";>






test path

Get method






пт, 24 янв. 2020 г. в 12:06, Riaan Annandale :

> Hi Mikhail
>
> For what it's worth, I asked a similar question before. Part of my REST
> config:
> if (Boolean.parseBoolean(System.getenv("authDisabled"))) {
> endpointProperty = "myLog";
> } else endpointProperty = "myLog, sessionHandler";
>
> restConfiguration()
> .component("jetty")
> .endpointProperty("handlers", endpointProperty)
>
> sessionHandler is an object that contains my integration into Keycloak for
> OAUTH2 things
>
> My use case was that I'd like to run a 2nd rest config on a different port
> (which will be unsecured) so that I can put a 2nd instance of my rest
> endpoints behind an API gateway. Unfortunately I received no response, so
> my solution was to run two instances of my camel code. I am fortunate
> enough to be able to do that because I don't keep state inside camel but
> rather in things like mongodb/ postgresql.
>
> Unless someone pipes up to let us know how to run multiple rest configs, I
> suggest looking at a solution like mine
>
> Riaan
>
> -Original Message-
> From: Mikhail Lukyanov 
> Sent: Friday, 24 January 2020 09:52
> To: users@camel.apache.org
> Subject: Is it possible to have several rest configurations in rest dsl,
> for example with http and https schemes on different ports?
>
> I hava one rest config for http scheme, but I need several configurations,
> for example, for https scheme to on different port. I use 2.20.2
> camel-version. My config
>
> *-http://camel.apache.org/schema/spring
> " id="rest">*
> *   - host="0.0.0.0" contextPath="/fesb-rest" component="jetty"
> bindingMode="off">*
> *   *
> **
> *   - produces="application/json" path="/path">*
> *   - produces="application/json" uri="/get">*
> *   *
> *   *
> **
> **
>


-- 
*С наилучшими пожеланиями, Лукьянов Михаил*
*Моб: **+7-909-69-71-547​*


File reading in Camel Apache via Stored Procedure | Spring XML

2020-01-24 Thread Sachin Padha
Hello Team,

I am trying to read the file and sending the file content to stored
procedure.
But the below route is returning : GenericFile[D:\in_1\MyFile.txt]
instead of file content as output parameter from stored procedure.

1) Route is reading file successfully
2) I am able to log body on the console
3) Same body when I sent as input parameter to Stored procedure, it is
returning:  GenericFile[D:\in_1\MyFile.txt]
4) When I set some string message (not related to file) in the body then it
is returning correctly.

*I have attached the output in text file for the below route*

*Below is the route and output in attached text file*




${body}


${body}








ok





 "Entered in Route Id: ${routeId}"\n 






Please let me know if you want more details regarding this issue
-- 
Thanks,
Sachin
2020-01-24 20:21:28.100  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : HelloFromFile
2020-01-24 20:21:28.103  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : HelloFromFile
2020-01-24 20:21:28.144  INFO 178632 --- [ile://D:%5Cin_1] 
com.zaxxer.hikari.HikariDataSource   : HikariPool-1 - Starting...
2020-01-24 20:21:29.228  INFO 178632 --- [ile://D:%5Cin_1] 
com.zaxxer.hikari.pool.PoolBase  : HikariPool-1 - Driver does not 
support get/set network timeout for connections. 
(oracle.jdbc.driver.T4CConnection.getNetworkTimeout()I)
2020-01-24 20:21:29.246  INFO 178632 --- [ile://D:%5Cin_1] 
com.zaxxer.hikari.HikariDataSource   : HikariPool-1 - Start completed.
2020-01-24 20:21:29.410  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : {OutBody=GenericFile[D:\in_1\MyFile.txt]}
2020-01-24 20:21:29.424  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : {OutBody=GenericFile[D:\in_1\MyFile.txt]}
2020-01-24 20:21:29.425  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : ok
2020-01-24 20:21:29.438  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : {OutBody=ok}
2020-01-24 20:21:29.439  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : "Entered in Route Id: P6: Reading from File or Queue 
and send to Proc"

2020-01-24 20:21:29.444  INFO 178632 --- [ile://D:%5Cin_1] ding from File or 
Queue and send to Proc : "Entered in Route Id: P6: Reading from File or Queue 
and send to Proc"

create or replace procedure TestFunc(InBody IN VARCHAR2, OutBody OUT VARCHAR2)
is
--l_out VARCHAR2(10);
begin
  --OutBody:='Hello from Out Variable';
  OutBody:=InBody;
end;



RE: Re: Bindy plus Unicode

2020-01-24 Thread Michael Greulich


Hi Alex, 

well, your comment was already very helpful. I created a custom DataFormat and 
ModelFactory from the default ones for FixedLength. Of course I obeyed the 
license terms of the Apache license ;-) For some aspect of recognizing chars, I 
used the ICU4J-lib, because the support for some things (e.g. emojis) in the 
Java runtime is not up to date. The license of ICU it quite permitting, too. 
I’ve no idea, if this is a problem for an Apache project...

Well I think I’m not the only one, that has this use-case -- so I  think this 
can be useful for the community, too. Currently I’m under pressure, but I think 
I will create a JIRA ticket when the stress has become less. If the community 
is interested, I can provide the code of my solution and would be glad if this 
thing goes upstream (i.e. into the camel distro) some day. 

Currently we (the company I work for) are using Camel 2.2 and I guess this will 
be the case for some time. If this feature or bug (not very determined what it 
actually is, I will leave the decision to the community)  in which version will 
it be included? Only Camel 3.x or will it be backported to 2.2?

-- Mik
  
--
Gesendet: Freitag, 24. Januar 2020 um 11:43 Uhr
Von: "Alex Dettinger" 
An: users@camel.apache.org
Betreff: Re: Bindy plus Unicode
Hi Michael,

I was just looking at this component for another purpose and it looks
to me that fixed length tokenzation occurs here:

https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java#L212..L216
So, It counts in java chars and not code points. You can maybe experiment
injecting a custom BindyFixedLengthFactory, via
dataFormat.setModelFactory(..).

Would you feel that an extension point to customize count/selection of
chars/codepoint/grapheme would be valuable to the community, feel free to
raise a JIRA ticket.

Alex


On Fri, Jan 24, 2020 at 9:52 AM Michael Greulich 
wrote:

> Hi,
>
> I’m having problems with the bindy component and wonder if there is
> something I missed. Maybe one can help me addressing it. I cannot believe,
> that I’m the first to hit this problem.
>
> I need to port an EAI application built using bindy, that reads a fixed
> type file(*) converts it and sends the data somewhere else. Currently this
> file is in Latin 1 encoding, but we need to take it to Unicode –
> effectively UTF-8. We have an ugly, but effectively unavoidable legacy
> application that creates the file.
>
> Unicode is a bit tricky, when it comes to counting the length of a string
> specially since Java uses internally UTF-16, which means depending on the
> codepoint 1 – 2 (Java-)chars. Bindy seems to use internally for selection
> substring and counts chars like Java does. This means the length of a
> string is the count of the chars, i.e. UTF-16 surrogates, but not
> codepoints, which is the common denominator (e.g. see definition of string
> length in XMLSchema). And when one takes combing chars into account (one
> “base char” plus 0 – n combining chars are perceived as one “char” by
> users) it becomes even more of a problem.
>
> Is there a possibility to tell bindy how it counts an and selects the
> tokens based on char counts in a given line? Any suggestions? Is the are
> related bug or change to come that addresses this problem?
>
> -- Mik
>
> (*) This means, that on certain positions there start certain data
> (columns if you will).
>
>
 
 


Re: Re: Bindy plus Unicode

2020-01-24 Thread Alex Dettinger
Hi Michael,

  Good to know that you sorted it out :) The compatibility between the
ICU4L and Apache License is not straightforward, we would need to look
closer.
Still creating a quick ticket and sharing a github project would make it
possible to save your work, and may be of interest later on to the
community.
  Would one provide a PR against 3.x, chances are that this could be
back-ported to 2.x. Please, keep time frame in mind as 2.x may close end of
this year.

Alex

On Fri, Jan 24, 2020 at 5:20 PM Michael Greulich 
wrote:

>
> Hi Alex,
>
> well, your comment was already very helpful. I created a custom DataFormat
> and ModelFactory from the default ones for FixedLength. Of course I obeyed
> the license terms of the Apache license ;-) For some aspect of recognizing
> chars, I used the ICU4J-lib, because the support for some things (e.g.
> emojis) in the Java runtime is not up to date. The license of ICU it quite
> permitting, too. I’ve no idea, if this is a problem for an Apache project...
>
> Well I think I’m not the only one, that has this use-case -- so I  think
> this can be useful for the community, too. Currently I’m under pressure,
> but I think I will create a JIRA ticket when the stress has become less. If
> the community is interested, I can provide the code of my solution and
> would be glad if this thing goes upstream (i.e. into the camel distro) some
> day.
>
> Currently we (the company I work for) are using Camel 2.2 and I guess this
> will be the case for some time. If this feature or bug (not very determined
> what it actually is, I will leave the decision to the community)  in which
> version will it be included? Only Camel 3.x or will it be backported to 2.2?
>
> -- Mik
>
> --
> Gesendet: Freitag, 24. Januar 2020 um 11:43 Uhr
> Von: "Alex Dettinger" 
> An: users@camel.apache.org
> Betreff: Re: Bindy plus Unicode
> Hi Michael,
>
> I was just looking at this component for another purpose and it looks
> to me that fixed length tokenzation occurs here:
>
>
> https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java#L212..L216
> So, It counts in java chars and not code points. You can maybe experiment
> injecting a custom BindyFixedLengthFactory, via
> dataFormat.setModelFactory(..).
>
> Would you feel that an extension point to customize count/selection of
> chars/codepoint/grapheme would be valuable to the community, feel free to
> raise a JIRA ticket.
>
> Alex
>
>
> On Fri, Jan 24, 2020 at 9:52 AM Michael Greulich <
> mich...@greulich-online.eu>
> wrote:
>
> > Hi,
> >
> > I’m having problems with the bindy component and wonder if there is
> > something I missed. Maybe one can help me addressing it. I cannot
> believe,
> > that I’m the first to hit this problem.
> >
> > I need to port an EAI application built using bindy, that reads a fixed
> > type file(*) converts it and sends the data somewhere else. Currently
> this
> > file is in Latin 1 encoding, but we need to take it to Unicode –
> > effectively UTF-8. We have an ugly, but effectively unavoidable legacy
> > application that creates the file.
> >
> > Unicode is a bit tricky, when it comes to counting the length of a string
> > specially since Java uses internally UTF-16, which means depending on the
> > codepoint 1 – 2 (Java-)chars. Bindy seems to use internally for selection
> > substring and counts chars like Java does. This means the length of a
> > string is the count of the chars, i.e. UTF-16 surrogates, but not
> > codepoints, which is the common denominator (e.g. see definition of
> string
> > length in XMLSchema). And when one takes combing chars into account (one
> > “base char” plus 0 – n combining chars are perceived as one “char” by
> > users) it becomes even more of a problem.
> >
> > Is there a possibility to tell bindy how it counts an and selects the
> > tokens based on char counts in a given line? Any suggestions? Is the are
> > related bug or change to come that addresses this problem?
> >
> > -- Mik
> >
> > (*) This means, that on certain positions there start certain data
> > (columns if you will).
> >
> >
>
>
>


org.apache.camel.NoSuchLanguageException: No language could be found for: simple

2020-01-24 Thread Alex Soto
Migrating to Camel 3.0.1 from (2.X), I have being going over the migration 
documentation here: 
https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc
 
,
 but now my integration is failing with:

org.apache.camel.NoSuchLanguageException: No language could be found for: simple
at 
org.apache.camel.impl.engine.DefaultLanguageResolver.noSpecificLanguageFound(DefaultLanguageResolver.java:92)
at 
org.apache.camel.impl.engine.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:68)
at 
org.apache.camel.impl.engine.AbstractCamelContext.resolveLanguage(AbstractCamelContext.java:1635)

This is a very simple code setting up a Camel context:

itCamelContext = new DefaultCamelContext();
itCamelContext.addComponent("http", new HttpComponent());
itCamelContext.setTracing(true);
itCamelContext.setStreamCaching(true);
itCamelContext.setName(this.getClass().getSimpleName());
itCamelContext.setClassResolver(new 
OsgiClassResolver(itCamelContext, bundleContext));
Language simple = itCamelContext.resolveLanguage("simple");
assertNotNull(simple);


Why would this happen?  Isn’t the Simple language part of the core anymore?  
FYI:  I am running as part of an OSGi environment (Karaf)

Best regards,
Alex soto






HTTP proxy problem

2020-01-24 Thread Ron Cecchini
Hi, all.

I have previously successfully used the HTTP component with proxy info to poll 
a site.

Bu now I'm running into a "connection reset" problem when polling another site 
that has a slightly different connection strategy.



The HTTP configuration for the first site was totally straight-forward:

url.full = https://bar.com/query?

proxy.params = authenticationPreemptive=true
&authMethod=Basic&proxyAuthScheme=http
&authUsername=&authPassword=
&proxyAuthHost=&proxyAuthPort=

and I was able to simply put the following in a timer route:

.to("{{url.full}}&{{proxy.params}}")



The second site requires a two-step login where you create an HTTP connection 
to:

https://www./ajaxauth/login

and then send the credentials and query together to the same HTTP connection:

identity=&password=&query=https://

You can combine both steps into a single command.  For example, in curl this 
works:

% curl https://www./ajaxauth/login -d 
'identity=&password=&query=https://'

And in fact, in a non-proxy environment, I was able to successfully poll the 
endpoint in Camel doing:

url.login = https://www./ajaxauth/login
url.post  = identity=&password=&query=https://

and putting this in my timer route:

.setHeader(Exchange.CONTENT_TYPE, 
constant("application/x-www-form-urlencoded"))
.setHeader(Exchange.HTTP_METHOD,  constant("POST"))
.setBody(simple("{{url.post}}"))   // makes the HTTP call a POST
.to("{{url.login}}")



But in a proxy environment, the second route no longer works.

With proxy info set to:

proxy.params = authenticationPreemptive=true
&authMethod={{proxy.method}}&proxyAuthScheme={{proxy.scheme}}
&proxyAuthHost={{proxy.host}}&proxyAuthPort={{proxy.port}}

I tried several combinations of where to put the proxy info; for example:

//.setBody(simple("{{url.post}}"))  // makes the HTTP call a POST
.setBody(simple("{{url.post}}&{{proxy.params}}"))  // makes the HTTP call a 
POST
.to("{{url.login}}&{{proxy.params}}")

but nothing worked.  Everything throws a java.net.SocketException: Connection 
reset.

I tried some other stuff, like setting the several "timeout" HTTP component 
parameters to 0 to make them infinite timeouts, but that didn't work either.

Thanks for any help.