brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schneider <Michael.Schnei...@virtustream.com>
Subject Re: Q: Return Values and Exceptions in Brooklyn Effectors
Date Thu, 26 Feb 2015 10:56:58 GMT
Thanks, Aled, this answers my questions.

Regards,
Michael


-------- Forwarded Message --------
Subject:

Re: Q: Return Values and Exceptions in Brooklyn Effectors

Date:

Wed, 25 Feb 2015 16:33:37 +0000

From:

Aled Sage <aled.sage@gmail.com><mailto:aled.sage@gmail.com>

Reply-To:

dev@brooklyn.incubator.apache.org<mailto:dev@brooklyn.incubator.apache.org>

To:

dev@brooklyn.incubator.apache.org<mailto:dev@brooklyn.incubator.apache.org>



Michael,



For return values...



If the effector is called programmatically by another entity then its

return value is available to the caller when the task completes.



The effector history is visible in the web-console's activities view,

which includes the result (e.g. "Completed with result: 2").



Over the REST api, one can retrieve the effector results. For example,

the URL http://localhost:8081/v1/activities/rvpUCn2x gives me the json

below (see "result":2):



    {"id":"rvpUCn2x","displayName":"resize","description":"Invoking

    effector resize on My Web with parameters

    {desiredSize=2}","entityId":"itvhuhSa","entityDisplayName":"My

    Web","tags":[{"wrappingType":"targetEntity","entity":{"type":"brooklyn.entity.Entity","id":"itvhuhSa"}},"EFFECTOR",{"wrappingType":"contextEntity","entity":{"type":"brooklyn.entity.Entity","id":"itvhuhSa"}},{"entityId":"itvhuhSa","effectorName":"resize"},{"entitlementContext":{"user":"admin","sourceIp":"0:0:0:0:0:0:0:1","requestUri":"/v1/applications/R5Vd6g3C/entities/itvhuhSa/effectors/resize","requestUniqueIdentifier":"DeoxWD"}}],"submitTimeUtc":1424878918642,"startTimeUtc":1424878918642,"endTimeUtc":1424878935055,"currentStatus":"Completed","result":2,"isError":false,"isCancelled":false,"children":[{"link":"/v1/activities/VHHukc4d","metadata":{"id":"VHHukc4d","taskName":"resize","entityId":"LIJ3tLGK","entityDisplayName":"Cluster

    of JBoss7Server (LocalhostMachineProvisioningLocation{id=tMSgdOE9,

    name=localhost})"}}],"submittedByTask":null,"detailedStatus":"Completed

    after 16.4s\n\nResult:

    2","streams":{},"links":{"self":"/v1/activities/rvpUCn2x","children":"/v1/activities/rvpUCn2x/children","entity":"/v1/applications/R5Vd6g3C/entities/itvhuhSa"}}



---

For exceptions...



If an effector method does not have a `throws XyzException`, then it can

still throw unchecked exceptions (i.e. java RuntimeExceptions). How the

exception is handled depends on the caller.



The web-console's activities view will always show the exception if

thrown by an effector.

If through the REST api, then the associated task will show the exception.

If the effector is manually invoked through the web-console, then it is

just reported in the web-console (also accessible over REST api).

If called by another effector, then the caller can handle the exception

how it sees fit (e.g. continue, or propagate).



Aled





On 25/02/2015 16:19, Michael Schneider wrote:

> Hi!

>

> I have two general questions about Brooklyn effectors.

>

> * On return values: When I define an effector with a return value type, what exactly
happens with the return value? Where is it shown? Is it stored somewhere? Does it have any
side effects on other parts of Brooklyn?

>

> * On exceptions: First of all, is there a point to declaring exceptions for a Brooklyn
effector at all? I ask because I haven't yet seen any exception declarations in Bernd's entity
interfaces, although I would expect that many real-world effectors would be naturally prone
to some sorts of error. One problem is, if I do not declare exceptions in my entity interfaces,
then, even if Brooklyn somehow automagically deals with them under the hood (does it?), I
would still need to deal with exceptions coming from calls to the backend systems within the
entity implementation code, and I cannot simply let them bubble up to Brooklyn, when I wouldn't
know otherwise what to do with them. But maybe there /is/ special treatment of declared exceptions
in Brooklyn? Please let me know!

>

> Michael

>

> Michael Schneider

> Senior Software Engineer

>

> Virtustream Inc.

> 6 Concourse Parkway | Suite 1930 | Atlanta | GA 30328

> Cell: +49 (176) 24102310

> michael.schneider@virtustream.com<mailto:michael.schneider@virtustream.com><mailto:michael.schneider@virtustream.com><mailto:michael.schneider@virtustream.com>
| www.virtustream.com<http://www.virtustream.com><http://www.virtustream.com/><http://www.virtustream.com/>

>

> Keep up with Virtustream:

> Blog<http://www.virtustream.com/blog/><http://www.virtustream.com/blog/>
* Twitter<https://twitter.com/#%21/virtustream><https://twitter.com/#%21/virtustream>
* LinkedIn<http://www.linkedin.com/company/virtustream><http://www.linkedin.com/company/virtustream>
* Slideshare<http://www.slideshare.net/Virtustream><http://www.slideshare.net/Virtustream>
* YouTube<http://www.youtube.com/user/Virtustream><http://www.youtube.com/user/Virtustream>

>

> The information contained in this electronic mail transmission may be privileged and
confidential, and therefore, protected from disclosure. If you have received this communication
in error, please notify us immediately by replying to this message and deleting the email
and its attachments from all computers without copying or disclosing it.

>






The information contained in this electronic mail transmission may be privileged and confidential,
and therefore, protected from disclosure. If you have received this communication in error,
please notify us immediately by replying to this message and deleting the email and its attachments
from all computers without copying or disclosing it.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message