One part of this that's been bothering mainly due to my ignorance of not
having used in my testing is the adviceWith.  And the weaveById.  Route
definitions throw the generic big E exception.  I wonder if you'd see
anyting in there if you did something like this.  At least that could
identify whether there was a problem there or not. By the way I'm
freehanding my try/catches there so the may not be aligned correctly.

  @Test
  public void testMessageReceived() throws Exception {
try{

context.getRouteDefinition("i4ip-order-publish-route").adviceWith(context,
new AdviceWithRouteBuilder() {
      @Override
      public void configure() throws Exception {
*try{*
        replaceFromWith("direct:in");
        weaveById("publishedMessage").after().to("mock:increment");
*} catch(Exception e) {*
*System.out.println("We threw an exception in the weaving".*
*      }*
*} catch(Excepion e)*
*System.out.println("We caught an error in the route builder."*
*}*
    });

On Tue, Sep 20, 2016 at 12:15 PM, Brad Johnson <brad.john...@mediadriver.com
> wrote:

> Too bootstrap a route from the Java DSL you only need to do something like
> this:
>
> <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
>
>      <package>my.routes.internal</package>
>
> </camelContext>
>
> And in the my.routes.internal package (or whatever you want to call it) you 
> would have route builder. You could put mock:out instead of direct:out.  
> You'll still use blueprint to export or import OSGi services if you are using 
> them but that's a trivial matter and I wouldn't worry about it just yet. 
> While those routes are hard coded in here you'll later replace them with 
> substitution variable names that you can change from the properties.  Use the 
> default properties first and then you can override them in you cfg file for 
> production.
>
> public class ARouteBuilder extends RouteBuilder {
>
>     public void configure() {
>
>         from("direct:in")
>            .log("${body}")
>            .to("direct:out");
>
>     }
>
> }
>
> Also, I'm not sure how IDEA works but I'm sure there's something
> equivalent to what one would do in Eclipse to start a project with a Maven
> archetype.  Just type in:
>
> camel-archetypes-
>
> and it should give you a list of sample archetypes to use to start a
> project.  Also, since you are using Fuse there's a selection of projects
> under the "quickstarts" directory in there.
>
> Brad
>
>
>
>
> On Tue, Sep 20, 2016 at 6:27 AM, owain <owain@integration.technology>
> wrote:
>
>> Brad,
>>
>> I am using <camel-version>2.15.6</camel-version> since this is the
>> closest
>> to Fuse-6.2.1.  I have just tried the test with CBTS 2.17.0.  Is there a
>> higher version?
>>
>> I add mock:increment (now refactored to mock:out) and replace the "from"
>> with direct:in in.
>>
>>
>> context.getRouteDefinition("i4ip-order-publish-route").advic
>> eWith(context,
>> new AdviceWithRouteBuilder() {
>>       @Override
>>       public void configure() throws Exception {
>>         replaceFromWith("direct:in");
>>         weaveById("publishedMessage").after().to("mock:out");
>>       }
>>     });
>>
>> Also I am drawing the same conclusion about the XML only approach.  Could
>> you kind enough to post and example to how to bootstrap the Java DSL from
>> the Blueprint XML.
>>
>> Thanks for your help. I will try putting it in a new project and see if
>> that
>> was the problem.  In a single xml file.
>>
>> O.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/org-osgi-service-blueprint-container-ComponentDefinition
>> Exception-Unable-to-validate-xml-tp5787642p5787758.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Reply via email to