5 Replies Latest reply on Oct 1, 2011 9:20 AM by jradecki

    Implementing custom patterns

    jamie3_james.archibald

      I was wondering if there was a way to implement custom patterns that do not implement Processor

       

      for example:

       

      from(...)

      .audit()   // custom pattern

      .to(...)

       

      If yes, is there any documentation on this? Or do you suggest a bettery way?

        • 1. Re: Implementing custom patterns
          jradecki

          Sure; let's talk.  First, DSL sucks; use the awesome Fuse IDE.  Why use ugly java code like that...lol. Camel/AMQ/Spring is king... need an example?

          • 2. Re: Implementing custom patterns
            davsclaus

            In Java DSL you can create a class which extends org.apache.camel.builder.RouteBuilder, where you can add additional methods.

             

            Then use your class when you create routes in Java DSL.

             

            However its a bit tricky to add new methods in the model classes from Camel, eg to add audit as a method on the ProcessorDefinition.

             

            I assume alternative languages such as Groovy and Scala has a way of making this easier.

            • 3. Re: Implementing custom patterns
              jradecki

              Say no to script; ioc/bytecode injection vs extends for audit. ?)

               

              Ohh, yeah, one more thing...  The builder pattern impl used by DSL is the best I've seen.   One thing I really hate about spring is not supporting return values for sets.  

               

              A camel xml command pattern created w/the fuse IDE for static boot and other camel xml's dynamical created (realtime) sent via jms header;  coupled w/Ioc&&BCI, way cool stuff.  Give it a try.

               

              Edited by: jradical on Oct 1, 2011 1:12 PM

              • 4. Re: Implementing custom patterns
                jamie3_james.archibald

                I would have to disagree. I've used Spring/Camel/AMQ in the past and for larger systems spring makes it is a nightmare when you have to perform refactoring jobs. Atleast DSL offers compile errors where as spring is runtime. Also, if you create your routes in spring, it offers no safe-guards when deploying your application. Someone can simply open up the spring file in the jar, make their modifications and disrupt the behaviour of the system.

                 

                The products we build are for customers who require a high-level security and the DSL provides a mechanism such that people can't mess around with the routes.

                 

                Finally, I don't want any new employees who work on the project to have to learn another tool. It's best to keep things simple. Having to get a new developer to learn camel + spring + FuseIDE is simply too much upfront.

                 

                Edited by: jamie3 on Oct 3, 2011 12:27 PM

                • 5. Re: Implementing custom patterns
                  jradecki

                  Probably why DSL and Spring are offered.   I hear what your saying but again respectfully disagree. 

                   

                  . Spring files are easily evaluated, transformed, monitored and re-factored independent of project scope (size).  In fact larger projects see greater benefit due to a bell curve.

                   

                  . Compiler and XSD validation are virtually equivalent as is code assist and schema assist.

                   

                  . Security, strongly disagree w/this one.  Spring files are easily encrypted, maintained and booted remotely&&realtime.  .class's, jars and configuration files are easily modified and pushed into the bootstrap. And there's not much that can be done about it.

                   

                  . I find the IDE is awesome tool for developers to learn EIP.   The latests cuts make the grade.

                   

                   

                  I enjoy these conversations, it's great to hear !another aspect, (!aop) lol.   Take care. 

                   

                  ps:And annotations should be deprecated.