On Mon, Feb 3, 2014 at 11:49 PM, toomanyedwards <[email protected]>wrote:
> Hi all, > In our camel routes we sometimes set header values dynamically, by doing > something like the following: > > .setHeader(SOME_HEADER_NAME).method(SomeClass.class, > SOME_METHOD_SIGNATURE_STRING) > > Ideally, we'd like to able to validate that the method specified by the > signature SOME_METHOD_SIGNATURE_STRING actually exists on SomeClass.class > *before* the route tries to invoke it at runtime and we potentially get a > runtime exception. ideally, this validation should happen at compile time > or at least on route initialization. What's the current camel best > practice > here to minimize possible runtime exceptions if the signature string is > incorrect? > Test your code before delivering it. ;-) > > I imagine somewhere internally camel is parsing > SOME_METHOD_SIGNATURE_STRING > and using reflection to do the method lookup based on the signature. Is > that something currently exposed by the api that we can leverage? Is there > a better way to do this? Thanks! > IF this is really an issue for you I would suggest to use a custom bean which extends Processor (which tie things more closely together). I prefer to have a test which makes sure the reflection/script/... stuff is working as expected... > > -e > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Best-practice-for-checking-method-exists-on-class-when-building-route-tp5746752.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
