2 Replies Latest reply on Jan 16, 2013 8:49 AM by Łukasz Dywicki

    Camel file binding get FileEndpoint

    Hamid RAHMOUNI Newbie



      I m trying to get the FileEndpoint Object on my "FileBindingBean" implementation of "FileBinding" service to get the properties of the class GenericFileEndpoint. I tried to extends the FileEndpoint class but it doesnt work.


      Could you please help me on this issue?


      Best Regards.

        • 1. Re: Camel file binding get FileEndpoint
          Keith Babo Master

          The FileEndpoint is not passed into the bean implementation.  You can inject an @Context reference which will allow you to query context properties inside your bean service.  More info on that can be found in the docs here:




          To give you an idea of which context properties are available to your implementation, here's a snip of a message trace from the camel-binding quickstart (which uses File gateway):


          Exchange Context -> 
                    CamelBatchIndex : 0
                    CamelBatchSize : 1
                    CamelToEndpoint : switchyard://GreetingService?namespace=urn%3Aswitchyard-quickstart%3Acamel-binding%3A0.1.0
                    CamelCreatedTimestamp : Wed Jan 16 08:30:50 EST 2013
                    CamelBatchComplete : true
                    CamelFileExchangeFile : GenericFile[test.txt]
          Message Context -> 
                    org.switchyard.contentType : java:java.lang.String
                    org.switchyard.messageId : a2ae79c6-88dd-4cec-a9b3-8cd08163cafb
          • 2. Re: Camel file binding get FileEndpoint
            Łukasz Dywicki Novice

            As workaround you can use:


            class Factory {
                @Produces @Named("file")
                public FileComponent create() {
                    return new FileComponent();
            class ServiceImpl implements SomeInterface {
                @Inject FileComponent component;
                // somewhere
                    FileEndpoint endpoint = (FileEndpoint) component.getCamelContext().getEndpoint("file-endpoint-uri");


            This however, is solution which can be assigned to 'dirty hack' category. Why you require endpoint instance inside your bean service?