0

Thx to Claus i got a wire tap working using a bean. But is there a way to give it a parameter (probably via header?)? In my case i would like to specify a file for output.

2 Answers 2

2

You can pass headers as parameters into your bean method, so for example if you have a header called "fileName":

public class WireTap {

    public PcrfEdrPostpaidWireTap(){
        System.out.println("wiretap constructor called");
    }

    @Handler
    public void handleBody(String body, @Header("fileName") String fileName){

        System.out.println("Wiretap says:" + body + " and the fileName is: "+fileName);
    }
}

More info can be found here: https://camel.apache.org/bean-binding.html and here http://camel.apache.org/parameter-binding-annotations.html

EDIT: To set a header you can use this:

<setHeader headerName="fileName">
    <constant>SampleFileName.txt</constant>
</setHeader>

You would do this before performing the wireTap

1
0

Use camel annotations to inject parameter values while doing bean invocation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.