camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Piggott <cpigg...@gmail.com>
Subject Re: @UriPath and @UriSyntax
Date Tue, 07 Apr 2015 14:55:45 GMT
I will try that, thanks.

For a test, I just tried getting back to basics, and getting rid of all the
Uri configuration entirely - just to see what happens.  I still have
META-INF/services/org/apache/camel/component/jssc (a text file) which
allows me to do:

    from("jssc:com10?baud=19200") ...

and it locates the component just fine.  The next thing I did was change
the Component to extend UriEndpointComponent rather than DefaultComponent.
That broke it as follows:

2015-04-07 10:15:41,550 [main] ERROR app.tasks.CamelTask - Failed to start
camel
org.apache.camel.FailedToCreateRouteException: Failed to create route
route1: Route(route1)[[From[jssc:com10?baud=19200]] -> [To[xmpp://cl...
because of Failed to resolve endpoint: jssc://com10?baud=19200 due to:
Cannot auto create component: jssc

So something, by doing that, just broke its ability to locate the endpoint
by name using the entry in META-INF.  The stack trace it gives me is not
exceptionally helpful; what it's really telling me is that it can't locate
my component.  What's especially confusing is that a UriEndpointComponent
extends DefaultComponent so it seems like, as far as camel is concerned,
they should be the same thing.


I checked in what I have so far ...

https://github.com/wz2b/camel-jssc/tree/master/src/main/java/com/autofrog/camel




On Tue, Apr 7, 2015 at 9:36 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> Hi
>
> Oh if you have this as a component outside Camel, then you need to add
> the apt plugin
> https://github.com/apache/activemq/blob/master/activemq-camel/pom.xml#L63
>
> And this plugin if you want to include a .properties file in the JAR
> with a list of components it contains
> https://github.com/apache/activemq/blob/master/activemq-camel/pom.xml#L217
>
> Then you do the same as all the components in Apache Camel.
>
> On Tue, Apr 7, 2015 at 3:34 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> > Hi
> >
> > All the 150+ components is an example of this. Just pick a similar /
> > simple component and see its source code.
> >
> > On Tue, Apr 7, 2015 at 3:12 PM, Christopher Piggott <cpiggott@gmail.com>
> wrote:
> >> Hi,
> >>
> >> According to
> >> https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.15.0+Release
> >>
> >>
> >>    - Custom components using @UriEndpoint must now include a syntax
> >>    attribute to document the uri syntax of the endpoint, when using the
> apt
> >>    compiler plugin to generate documentation.
> >>
> >>
> >> I'm looking for documentation on this and not really finding how to use
> it
> >> or simple examples:
> >>
> >>
> >>    - http://camel.apache.org/endpoint-annotations.html  says what it
> is,
> >>    but not how to use it
> >>    -
> >>
> https://github.com/sigrist/camel-rxtx/blob/master/src/main/java/org/apache/camel/rxtx/RxTxEndpoint.java
> >>    is an example soembody wrote that uses @UriParam ... that works
> fine, but
> >>    when I try to add a @UriPath parameter it silently ends up  null
> >>    - Tons of examples in git but most of them don't have a 'syntax=' so
> I
> >>    must be looking at old source
> >>
> >>
> >> Trying to piece all this together from scarce examples and
> documentation:
> >>
> >>
> >>    - It doesn't seem like I really need to extend
> UriComponentConfiguration
> >>    at all, do I?  If I declare my component a @ManagedResource it seems
> to
> >>    bind all the @UriParam just fine.  It doesn't bind the @UriPath
> parameters,
> >>    though, and fails to do so silently, despite the fact that they are
> marked
> >>    @Meadata(required = "true").
> >>    - Are there any simple examples out there using
> >>    @UriComponentConfiguration ?
> >>
> >>
> >> --Chris
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8: http://fabric8.io/
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message