Context properties and attachments are not available for references injected into bean services using @Reference.
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Resolved
Keith Babo <kbabo> made a comment on jira SWITCHYARD-1465 pushed
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Reopened
Created attachment 837731 [details] reporducer
Properties set to a reply in one bean component are null in the receiving bean component. I have attached a reproducer. Everything else seems to work as it should.
Steps to reproduce: 1. run AS 2. unpack reproducer 3. execute: mvn clean package jboss-as:deploy exec:java jboss-as:undeploy Actual result: Greetings to John Doe from ServiceA Greetings to John Doe from ServiceB [propertyB=null] Expected result: Greetings to John Doe from ServiceA Greetings to John Doe from ServiceB [propertyB=valueB]
This is actually an issue with the app. The context you injected in ServiceBBean is for the request context. This is the one corner case that was really hard to fit into the existing API. The procedure to set a context property on the response is a bit convoluted unfortunately: @Inject Exchange exchange; @Override public String call(String name) { Message message = exchange.createMessage(); message.setContent("Greetings to " + name + " from ServiceB"); message.getContext().setProperty("propertyB", "valueB"); exchange.send(message); // return ignored in favor of object used with send() above return null; }
Just for completeness. The property can be obtained in ServiceABean this way: String propertyB = invocation.getContext().getPropertyValue("propertyB");
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Closed