The following is additional information to my original post:

i have done similar steps as follows at karaf console after starting karaf
before deploying my features file into deploy directory.

1) features:chooseurl cxf 2.7.5 
2) features:install cxf 
3) features:chooseurl camel 2.10.3 
4) features:install camel 
5) features:install camel-cxf 

The following is an extract of my features file:

<?xml version="1.0" encoding="UTF-8"?>
<features name="oacc.features-0.0.1-SNAPSHOT"
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0";>
        
        
        <feature name='osgi-compendium' description='OSGi compendium feature'
version='4.3.1' resolver='(obr)'>
        <bundle
start-level="10">mvn:org.osgi/org.osgi.compendium/4.3.1</bundle>
    </feature>

        
    <feature name='scala' description='Scala' version='2.10.2'
resolver='(obr)'>
      <bundle
start-level="15">mvn:org.scala-lang/scala-library/2.10.2</bundle>
    </feature>

        
        <feature name='typesafe-config' description='Typesafe config'
version='1.0.2' resolver='(obr)'>
        <feature version="[2.10.0,2.11.0)">scala</feature>
        <bundle start-level="25">mvn:com.typesafe/config/1.0.2</bundle>
    </feature>
        
        <feature name='akka' description='Akka' version='2.2.0' 
resolver='(obr)'>
        <feature version="[2.10.0,2.11.0)">scala</feature>
                
                <feature version="[1.0.2,2.0.0)">typesafe-config</feature>
                
        
        <bundle
start-level="30">mvn:com.typesafe.akka/akka-osgi_2.10/2.2.0</bundle>
        <bundle
start-level="30">mvn:com.typesafe.akka/akka-camel_2.10/2.2.0</bundle>
                <bundle
start-level="30">mvn:com.typesafe.akka/akka-slf4j_2.10/2.2.0</bundle>
                
                
    </feature>
        
        <feature name='oacc-bundles' description='OACC' version='0.0.1-SNAPSHOT'
resolver='(obr)'>
                <feature>http</feature>
                <feature>cxf</feature>
                <feature>camel</feature>
        <feature version="[2.2.0,3.0.0)">akka</feature>
                
        <bundle
start-level="50">mvn:com.diebold.agilis/OACCCore/0.0.1-SNAPSHOT</bundle>
                <bundle
start-level="51">mvn:com.diebold.agilis/OACCBundleOne/0.0.1-SNAPSHOT</bundle>
                
    </feature>
        
</features>


MyCamel CXFRS Actor:

import javax.ws.rs.core.Response;

import akka.camel.CamelMessage;
import akka.camel.javaapi.UntypedConsumerActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;

/**
 * @author Ramakrishna Sharvirala
 *
 */
public class OACCCamelCXFRestActor extends UntypedConsumerActor {
        
        /**
         * AKKA logging adapter to do asynchronous logging.
         */
        private LoggingAdapter log = Logging.getLogger(getContext().system(),
this);
        
        @Override
        public String getEndpointUri() {
                //return
"mina:tcp://127.0.0.1:6200?textline=false&sync=true&exchangePattern=InOut&transferExchange=true";
                return
"cxfrs:http://127.0.0.1:7070/test/services/rest/oacc/?bindingStyle=SimpleConsumer&resourceClasses=com.ignitedcoders.app.oacc.rest.OACCRestService";;
        }
        
        @Override
        public void onReceive(Object message) throws Exception {
                if (message instanceof CamelMessage) {
                        CamelMessage camelMessage = (CamelMessage) message;

                        String body = camelMessage.getBodyAs(String.class, 
getCamelContext());
                        log.info("Received Message : {} ", body);
                        
                        System.out.println(body);

                        sender().tell(new 
CamelMessage(Response.ok().entity("Test
Response").build(), camelMessage.getHeaders()), getSelf());
                        //sender().tell(new CamelMessage("EmptyResponse",
camelMessage.getHeaders()), getSelf());
                }       else {
                        unhandled(message);
                }
                
        }
        
        /**
         * No auto ack!
         */
        @Override
        public boolean autoAck() {
                return false;
        }
}


MyBundleActivator Start Method code:

               ServiceTracker serviceTracker = new ServiceTracker(context,
ActorSystem.class.getName(), null);
                
                serviceTracker.open();
                ActorSystem system = (ActorSystem)serviceTracker.getService();
                
                System.out.println(context.getBundle().getSymbolicName() + ":" +
context.getBundle().getBundleId());
                
                //1. Normal Actor Creation
                ActorRef normalActorRef =
system.actorOf(Props.create(OACCNormalActor.class), "OACCNormalActor");
                System.out.println(normalActorRef != null ? 
normalActorRef.path() :
"ActorRef is null");
                
                Camel camel =  CamelExtension.get(system);
                camel.context().setTracing(true);
                //camel.context().setDebugger();
                Timeout timeout = new Timeout(Duration.create(10, 
TimeUnit.SECONDS));
                
                Future<ActorRef> activationFuture =
camel.activationFutureFor(normalActorRef, timeout, system.dispatcher());
                activationFuture.onComplete(new OnComplete<ActorRef>() {
                        @Override
                        public void onComplete(Throwable throwable, ActorRef 
actorRef)
                                        throws Throwable {
                                if(throwable != null) {
                                        System.out.println("The below is error 
thrown from actor creation");
                                        throwable.printStackTrace();
                                } else {
                                        System.out.println("Actor is 
Successfully Created");
                                }
                        }
                }, system.dispatcher());
                
                
                //2. Camel CXF RS Based Actor Creation
                ActorRef camelBasedActorRef =
system.actorOf(Props.create(OACCCamelCXFRestActor.class),
"OACCCamelCXFRestActor");
                
                System.out.println(camelBasedActorRef != null ? 
camelBasedActorRef.path()
: "ActorRef is null");
                
                camel.context().setTracing(true);
                
                
                activationFuture = 
camel.activationFutureFor(camelBasedActorRef, timeout,
system.dispatcher());
                activationFuture.onComplete(new OnComplete<ActorRef>() {
                        @Override
                        public void onComplete(Throwable throwable, ActorRef 
actorRef)
                                        throws Throwable {
                                if(throwable != null) {
                                        System.out.println("The below is error 
thrown from actor creation");
                                        throwable.printStackTrace();
                                } else {
                                        System.out.println("Actor is 
Successfully Created");
                                }
                        }
                }, system.dispatcher());


Please, let me know your thoughts on same.

Note: 1) Even tried with explicit registration of component with the
following line of code while registering camel cxfrs based actor with actory
system:
camel.context().addComponent("cxfrs", new CxfRsComponent(camel.context()));
2) Based on 1, it throws the exception like error due to <restservice class>
mentioned on endpoint url of consumer actor.

Regards
Ramakrishna



--
View this message in context: 
http://camel.465427.n5.nabble.com/Deployment-of-Akka-Camel-CXF-Osgi-sample-in-Apache-Karaf-container-tp5739297p5739828.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to