Bug 1015927 - Unable to access context properties for references in Bean services
Unable to access context properties for references in Bean services
Status: CLOSED CURRENTRELEASE
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard (Show other bugs)
6.0.0 GA
Unspecified Unspecified
unspecified Severity medium
: ER7
: 6.0.0
Assigned To: Keith Babo
Tomas Rohovsky
:
Depends On:
Blocks: 1024882
  Show dependency treegraph
 
Reported: 2013-10-06 17:54 EDT by Keith Babo
Modified: 2016-01-04 00:58 EST (History)
3 users (show)

See Also:
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: ---


Attachments (Terms of Use)
reporducer (8.75 KB, application/zip)
2013-12-17 10:27 EST, Tomas Rohovsky
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SWITCHYARD-1465 Major Closed Make Context and Message available to bean services on all paths 2016-11-30 00:00 EST

  None (edit)
Description Keith Babo 2013-10-06 17:54:30 EDT
Context properties and attachments are not available for references injected into bean services using @Reference.
Comment 1 JBoss JIRA Server 2013-10-07 07:00:37 EDT
Keith Babo <kbabo@redhat.com> updated the status of jira SWITCHYARD-1465 to Resolved
Comment 2 JBoss JIRA Server 2013-10-07 07:00:37 EDT
Keith Babo <kbabo@redhat.com> made a comment on jira SWITCHYARD-1465

pushed
Comment 3 JBoss JIRA Server 2013-10-07 07:03:10 EDT
Keith Babo <kbabo@redhat.com> updated the status of jira SWITCHYARD-1465 to Reopened
Comment 6 Tomas Rohovsky 2013-12-17 10:27:02 EST
Created attachment 837731 [details]
reporducer
Comment 7 Tomas Rohovsky 2013-12-17 10:27:41 EST
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 10:31:16 EST
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 10:43:09 EST
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 11:29:10 EST
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 19:53:16 EDT
Keith Babo <kbabo@redhat.com> updated the status of jira SWITCHYARD-1465 to Closed

Note You need to log in before you can comment on or make changes to this bug.