From d5614ff3e8867b22fcb5b5b10627925a17a441cd Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 18 Jun 2010 00:14:33 +0000 Subject: [PATCH] INT-1139, fixed the docs --- src/docbkx/message-publishing.xml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/docbkx/message-publishing.xml b/src/docbkx/message-publishing.xml index bd0547efe8..4f6d108c79 100644 --- a/src/docbkx/message-publishing.xml +++ b/src/docbkx/message-publishing.xml @@ -3,7 +3,7 @@ Message Publishing - Message Publishing feature will allow you to send a message as a result of method invocation. For example; Imagine you + Message Publishing feature will allow you to construct and send a message as a by-product of method invocation. For example; Imagine you have a component and every time the state of this components changes you would like to get notified. The easiest way to send notification would be to send a message to a dedicated channel, but how would you connect the method invocation that changes the state of the object to a message sending process and what should be the structure of the @@ -26,6 +26,14 @@ Internally PublisherAnnotationAdvisor uses Spring 3.0 Expression Language support giving you the flexibility and control over the structure of a Message it will build. + + +@Publisher(value="#return", channel="testChannel", headers="bar='123',fname=#args.fname") +public String setName(String fname, String lname){ + return fname + " " + lname; +} + + PublisherAnnotationAdvisor defines and binds the following variables: @@ -38,17 +46,12 @@ #exception - will bind to an exception if one is thrown. - #[parameName] - will be dynamically constructed pointing to the method parameter - names (e.g., #fname as in the above method) + #args - will bind to method arguments, so individual arguments could be extracted by name + (e.g., #args.fname as in the above method) - -@Publisher(value="#return", channel="testChannel", headers="bar='123',fname=#fname") -public String setName(String fname, String lname){ - return fname + " " + lname; -} - + In the above example the Message will be constructed and its structure will be as follows: @@ -56,7 +59,7 @@ public String setName(String fname, String lname){ Message payload - will be of type String and contain the value returned by the method. - Message headers will be 'bar' with value of "123" and 'fname' with value of 'fname' parameter of the method. + Message headers will be 'bar' with value of "123" and 'fname' with value of 'fname' argument of the method.