Bug 1015927

Summary: Unable to access context properties for references in Bean services
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Keith Babo <kbabo>
Component: SwitchYardAssignee: Keith Babo <kbabo>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas Rohovsky <trohovsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0 GACC: ldimaggi, oskutka, soa-p-jira
Target Milestone: ER7   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1024882 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1024882    
Attachments:
Description Flags
reporducer none

Description Keith Babo 2013-10-06 21:54:30 UTC
Context properties and attachments are not available for references injected into bean services using @Reference.

Comment 1 JBoss JIRA Server 2013-10-07 11:00:37 UTC
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Resolved

Comment 2 JBoss JIRA Server 2013-10-07 11:00:37 UTC
Keith Babo <kbabo> made a comment on jira SWITCHYARD-1465

pushed

Comment 3 JBoss JIRA Server 2013-10-07 11:03:10 UTC
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Reopened

Comment 6 Tomas Rohovsky 2013-12-17 15:27:02 UTC
Created attachment 837731 [details]
reporducer

Comment 7 Tomas Rohovsky 2013-12-17 15:27:41 UTC
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.

Comment 8 Tomas Rohovsky 2013-12-17 15:31:16 UTC
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]

Comment 9 Keith Babo 2013-12-17 15:43:09 UTC
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;
}

Comment 10 Tomas Rohovsky 2013-12-17 16:29:10 UTC
Just for completeness. The property can be obtained in ServiceABean this way:

String propertyB = invocation.getContext().getPropertyValue("propertyB");

Comment 11 JBoss JIRA Server 2014-06-16 23:53:16 UTC
Keith Babo <kbabo> updated the status of jira SWITCHYARD-1465 to Closed