Hi, It seems the API ComponentContext.getRequestContext().getCallbackReference() will not work if the service is pormte to composite service and used by other compsite as implementation.composite. Here are the composite files I tried:
innercomposite: <?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://inner" name="InnerComposite"> <service name="Source" promote="InnerSourceComponent" interface="source.Source" callbackInterface="source.SourceCallback" > </service> <component name="InnerSourceComponent"> <implementation.java class="source.SourceImpl"/> </component> </composite> OuterComposite: <?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://outer" xmlns:inner="http://inner" name="OuterComposite"> <component name="InnerComponent"> <implementation.composite name="inner:InnerComposite"/> <service name="Source" interface="source.Source" callbackInterface="source.SourceCallback" > </service> </component> <component name="RequestComponent"> <implementation.java class="request.RequestImpl"/> <reference name="sourceReference" target="InnerComponent/Source" /> </component> </composite> SourceImpl.java: @Service(Source.class) @Scope("COMPOSITE") public class SourceImpl implements Source{ final static Logger logger = Logger.getLogger(SourceImpl.class); private SourceCallback cb; private ComponentContext ct; @Context public void setContext(ComponentContext context) { logger.debug("Set ComponentContext "); ct = context; } /* @Callback public void setSourceCallback(SourceCallback sourceCallback) { logger.info("Set callback "); cb = sourceCallback; } */ public void clientMethod(String arg) { logger.debug("SOurce clientMehod"); cb = (SourceCallback) ct.getRequestContext().getCallbackReference().getService(); cb.receiveResult("Callbak response "+ arg); } } When method clientMethod() is invoked, the getCallbackReference only reutrns NULL. However, the callbackReference is able to be injected by using @Callback annotation. Would you like to check my composites/java files to help me fimd out where the error happens. Thanks Dong
