camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bart Horré <>
Subject Re: inject OSGi service into Camel Route
Date Fri, 16 Jun 2017 08:52:48 GMT

in the below code example you'll find a blueprint file containing a
reference to the service which is then inserted in a camel route.
This can of course  also be done in Spring.
I hope this is of any use to you.

<?xml version="1.0" encoding="UTF-8"?>
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version
    2.0 (the "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at Unless required by
    applicable law or agreed to in writing, software distributed under the
    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, either express or implied. See the License for
    the specific language governing permissions and limitations under the
<!-- Configures the Camel Context-->
<blueprint xmlns="">

    <reference id="service" interface="com.example.MyService"/>

    <bean id="routes" class="com.example.MyRoute">
        <argument ref="service"/>

    <camelContext xmlns="">
        <routeBuilder ref="routes"/>

public class MyRoute extends RouteBuilder {

    private MyService service;

    public MyRoute(MyService service) {
        this.service = service;

    public void configure() {


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message