[prev in list] [next in list] [prev in thread] [next in thread] 

List:       synapse-dev
Subject:    Re: Adding hot deployment/update support to synapse custom mediators
From:       Kasun Indrasiri <kasun147 () gmail ! com>
Date:       2013-04-13 7:55:52
Message-ID: CAFgWgtrWJc9-R_=5EA+Xha7wpGWV1Md160to8k0hUx90vdhydQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Yes, I managed to get it work for custom mediator as well. We basically
load the serilizers and factories prior to deploying the synapse-lib as we
do with xar. So, we can pack all our custom mediators along with
factories/seriaizers and refer them using templates. I too
think library approach is more powerful compared to xar (we can deprecate
.xar once we have added the same functionality into synapse lib).

(Attached the patch and sample synapse-lib file  used for testing)


On Fri, Apr 12, 2013 at 1:25 PM, Udayanga Wickramasinghe <
mastershield2007@gmail.com> wrote:

> Hi Kasun,
> 
> On Thu, Apr 11, 2013 at 6:14 AM, Kasun Indrasiri <kasun147@gmail.com>wrote:
> 
> > Hi Udayanga/Amila,
> > 
> > I have basically tried xar and synapse-lib approaches.
> > 
> > *XAR - Entension Deployer *
> > *
> > *
> > - The extension deployer seems to carter these requirements. For
> > instance, we can create a custom mediator and create a .xar with the use of
> > xar plugin.
> > - I've tested with a simple custom mediator and
> > deployed( /repository/extensions) that as an .xar. It works fine for hot
> > deployment and hot update (only if we update the referring sequence)
> > - However  the limitation here is that, once the xar is hot updated, what
> > ever the sequence that are referring this particular customer mediator has
> > to be redeployed to take the new modifications of mediator in to effect.
> > 
> > *Synapse-Lib*
> > *
> > *
> > - With this approach we can hot deploy/hot update a '*class*' mediator
> > as long as the class mediators reside in the templates which are bundled
> > with the sample synapse-lib archive. So, without redeploying the sequence
> > that are calling (call-template) those templates.
> > - However, the hot deployment nor hot update doesn't work for '*custom*'
> > mediators(with factories and serializers) and its because the newly added
> > custom mediator factory and serializers not loaded by the Library deployer.
> > I think we could fix the Library deployer to support custom mediators as
> > well (as we do with xar).
> > 
> 
> currently mediation library doesn't register factory and serializer
> services on deployment.. I think this can be fixed fairly quickly as with
> xar. Although both solutions seem to work i think synapse
> library archives have more of a advantage with not having to
> re-deploy referring sequences whenever an update takes place..
> 
> Thanks
> Udayanga
> 
> 
> > 
> > 2013-04-11 15:34:07,223 [-] [Timer-0] ERROR LibraryArtifactDeployer
> > Deployment of the Synapse Artifact from file :
> > /home/kasun/development/wso2/wso2svn/apache/synapse/new_trunk/modules/distribution \
> > /target/synapse-2.2.0-SNAPSHOT/repository/conf/synapse-libs/synapse-eipcore-lib.zip
> >  : Failed!
> > org.apache.synapse.deployers.SynapseArtifactDeploymentException: Template
> > configuration : null cannot be builtfor Synapse Library artifact :
> > dynamic_router
> > at
> > org.apache.synapse.libraries.model.LibraryArtifact$TemplateArtifactFile.build(LibraryArtifact.java:183)
> >  at
> > org.apache.synapse.libraries.model.LibraryArtifact.loadComponentsInto(LibraryArtifact.java:100)
> >                 
> > ...
> > Caused by: org.apache.synapse.SynapseException: Unknown mediator
> > referenced by configuration element : {
> > http://ws.apache.org/ns/synapse}surchargeStockQuote
> > 
> > 
> > Any thoughts?
> > 
> > Thanks,
> > 
> > 
> > 
> > On Mon, Apr 8, 2013 at 3:03 AM, Udayanga Wickramasinghe <
> > mastershield2007@gmail.com> wrote:
> > 
> > > Hi Amila,
> > > It works more or less similar to axis2 archive file (.aar) and
> > > class-loading is very similar (ie:- loads classes from top level of the
> > > archive or from .jar files located in /lib ).. However each time a
> > > mediation library archive is deployed it will load (ie:- lazy loading) the
> > > content in to memory, construct class-loading , etc . And only after users
> > > explicitly import (ie:- through <import ..> synapse construct ) the library
> > > package , would synapse load its artifacts and made available to its users
> > > at runtime...
> > > More information on this can be found
> > > in docs/userguide/template_library.html . Also set of samples can be found
> > > in samples catalog -- samples 850 - 857
> > > If you want to test above samples EIP core library will be located in
> > > "modules/core/target/library_repos/synapse-eipcore-lib.zip" and copy the
> > > file into synapse distribution "repository/conf/synapse-libs" path..
> > > 
> > > Regards,
> > > Udayanga
> > > 
> > > 
> > > On Sun, Apr 7, 2013 at 11:22 AM, Amila Suriarachchi <
> > > amilasuriarachchi@gmail.com> wrote:
> > > 
> > > > 
> > > > 
> > > > 
> > > > On Sun, Apr 7, 2013 at 3:36 AM, Udayanga Wickramasinghe <
> > > > mastershield2007@gmail.com> wrote:
> > > > 
> > > > > Hi Amila,
> > > > > If you look up at the newly added synapse mediation library archive
> > > > > (.zip) feature , has the same functionality you are looking for. You should
> > > > > be able to hot update/deploy custom mediators (deploy custom mediators at
> > > > > /lib of the archive) and/or almost any other synapse artifact , through
> > > > > that.
> > > > > 
> > > > 
> > > > Do you know how that works? How do we have to deploy the custom
> > > > mediators and how synapse load classes?
> > > > 
> > > > Basically if that provides hot update/deploy that is fine.
> > > > 
> > > > thanks,
> > > > Amila.
> > > > 
> > > > > 
> > > > > Regards,
> > > > > Udayanga
> > > > > 
> > > > > 
> > > > > On Sun, Apr 7, 2013 at 6:01 AM, Amila Suriarachchi <
> > > > > amilasuriarachchi@gmail.com> wrote:
> > > > > 
> > > > > > hi,
> > > > > > 
> > > > > > Currently Synapse custom mediators has to deploy as a jar and should
> > > > > > be available at the server starts up time. But there are situations we \
> > > > > > need to hot update/deploy these custom mediators.
> > > > > > 
> > > > > > Can we have a method like in .aar files where we bundle synapse
> > > > > > mediators as an archive file possibly with a descriptor file and make it
> > > > > > hot update deploy?
> > > > > > 
> > > > > > thanks,
> > > > > > Amila.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > --
> > > > > > Amila Suriarachchi
> > > > > > WSO2 Inc.
> > > > > > blog: http://amilachinthaka.blogspot.com/
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --
> > > > > http://www.udayangawiki.blogspot.com
> > > > > 
> > > > 
> > > > 
> > > > 
> > > > --
> > > > Amila Suriarachchi
> > > > WSO2 Inc.
> > > > blog: http://amilachinthaka.blogspot.com/
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > http://www.udayangawiki.blogspot.com
> > > 
> > 
> > 
> > 
> > --
> > Kasun Indrasiri
> > Associate Technical Lead,
> > WSO2 Inc. - "Lean . Enterprise . Middleware" - http://www.wso2.com/
> > Blog : http://kasunpanorama.blogspot.com/
> > 
> 
> 
> 
> --
> http://www.udayangawiki.blogspot.com
> 



-- 
Kasun Indrasiri
Associate Technical Lead,
WSO2 Inc. - "Lean . Enterprise . Middleware" - http://www.wso2.com/
Blog : http://kasunpanorama.blogspot.com/


[Attachment #5 (text/html)]

<div dir="ltr">Yes, I managed to get it work for custom mediator as well. We \
basically load the serilizers and factories prior to deploying the synapse-lib as we \
do with xar. So, we can pack all our custom mediators along with factories/seriaizers \
and refer them using templates. I too think library approach is more powerful \
compared to xar (we can deprecate .xar once we have added the same functionality into \
synapse lib). <div> <br></div><div style>(Attached the patch and sample synapse-lib \
file  used for testing)</div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Fri, Apr 12, 2013 at 1:25 PM, Udayanga Wickramasinghe <span \
dir="ltr">&lt;<a href="mailto:mastershield2007@gmail.com" \
target="_blank">mastershield2007@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Kasun,<div><br><div \
class="gmail_extra"><div class="gmail_quote"><div class="im">On Thu, Apr 11, 2013 at \
6:14 AM, Kasun Indrasiri <span dir="ltr">&lt;<a href="mailto:kasun147@gmail.com" \
target="_blank">kasun147@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Udayanga/Amila,<div><br></div><div>I have \
basically tried xar and synapse-lib approaches. </div><div>



<br></div><div><u>XAR - Entension Deployer </u></div><div><u><br></u></div><div>
- The extension deployer seems to carter these requirements. For instance, we can \
                create a custom mediator and create a .xar with the use of xar \
                plugin. </div><div>
- I&#39;ve tested with a simple custom mediator and deployed( /repository/extensions) \
that as an .xar. It works fine for hot deployment and hot update (only if we update \
the referring sequence) </div><div>- However  the limitation here is that, once the \
xar is hot updated, what ever the sequence that are referring this particular \
customer mediator has to be redeployed to take the new modifications of mediator in \
to effect. </div>





<div><br></div><div><u>Synapse-Lib</u></div><div><u><br></u></div><div>- With this \
approach we can hot deploy/hot update a &#39;<i>class</i>&#39; mediator as long as \
the class mediators reside in the templates which are bundled with the sample \
synapse-lib archive. So, without redeploying the sequence that are calling \
(call-template) those templates. </div>




<div>- However, the hot deployment nor hot update doesn&#39;t work for \
&#39;<i>custom</i>&#39; mediators(with factories and serializers) and its because the \
newly added custom mediator factory and serializers not loaded by the Library \
deployer. I think we could fix the Library deployer to support custom mediators as \
well (as we do with xar). </div>



</div></blockquote><div><br></div></div><div>currently mediation library doesn&#39;t \
register factory and serializer services on deployment.. I think this can be fixed \
fairly quickly as with xar. Although both solutions seem to work i think synapse \
library archives have more of a advantage with not having to re-deploy referring \
sequences whenever an update takes place.. </div>



<div><br></div><div>Thanks</div><div>Udayanga</div><div><div class="h5"><div> \
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"> <div><br></div><div><div>2013-04-11 \
15:34:07,223 [-] [Timer-0] ERROR LibraryArtifactDeployer Deployment of the Synapse \
Artifact from file : \
/home/kasun/development/wso2/wso2svn/apache/synapse/new_trunk/modules/distribution/target/synapse-2.2.0-SNAPSHOT/repository/conf/synapse-libs/synapse-eipcore-lib.zip \
: Failed!</div>




<div>org.apache.synapse.deployers.SynapseArtifactDeploymentException: Template \
configuration : null cannot be builtfor Synapse Library artifact : \
dynamic_router</div><div><span style="white-space:pre-wrap">	</span>at \
org.apache.synapse.libraries.model.LibraryArtifact$TemplateArtifactFile.build(LibraryArtifact.java:183)</div>





<div><span style="white-space:pre-wrap">	</span>at \
org.apache.synapse.libraries.model.LibraryArtifact.loadComponentsInto(LibraryArtifact.java:100)</div><div>...</div></div><div>Caused \
by: org.apache.synapse.SynapseException: Unknown mediator referenced by configuration \
element : {<a href="http://ws.apache.org/ns/synapse%7DsurchargeStockQuote" \
target="_blank">http://ws.apache.org/ns/synapse}surchargeStockQuote</a><br>




</div>
<div><br></div><div><br></div><div>Any thoughts? \
</div><div><br></div><div>Thanks,</div><div><br></div></div><div \
class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Mon, Apr 8, 2013 at \
3:03 AM, Udayanga Wickramasinghe <span dir="ltr">&lt;<a \
href="mailto:mastershield2007@gmail.com" \
target="_blank">mastershield2007@gmail.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Amila,<div>It works more or less similar to \
axis2 archive file (.aar) and class-loading is very similar (ie:- loads classes from \
top level of the archive or from .jar files located in /lib ).. However each time a \
mediation library archive is deployed it will load (ie:- lazy loading) the content in \
to memory, construct class-loading , etc . And only after users explicitly import \
(ie:- through &lt;import ..&gt; synapse construct ) the library package , would \
synapse load its artifacts and made available to its users at runtime...</div>





<div>More information on this can be found in docs/userguide/template_library.html . \
Also set of samples can be found in samples catalog -- samples 850 - 857</div><div>If \
you want to test above samples EIP core library will be located in \
&quot;modules/core/target/library_repos/synapse-eipcore-lib.zip&quot; and copy the \
file into synapse distribution &quot;repository/conf/synapse-libs&quot; path..</div>





<div><br></div><div>Regards,</div><div>Udayanga</div></div><div \
class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Sun, Apr 7, 2013 at \
11:22 AM, Amila Suriarachchi <span dir="ltr">&lt;<a \
href="mailto:amilasuriarachchi@gmail.com" \
target="_blank">amilasuriarachchi@gmail.com</a>&gt;</span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div \
class="gmail_quote"><div>On Sun, Apr 7, 2013 at 3:36 AM, Udayanga Wickramasinghe \
<span dir="ltr">&lt;<a href="mailto:mastershield2007@gmail.com" \
target="_blank">mastershield2007@gmail.com</a>&gt;</span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Amila,<div>If you look up at the newly \
added synapse mediation library archive (.zip) feature , has the same functionality \
you are looking for. You should be able to hot update/deploy custom mediators (deploy \
custom mediators at /lib of the archive) and/or almost any other synapse artifact , \
through that.</div>






</div></blockquote><div><br></div></div><div>Do you know how that works? How do we \
have to deploy the custom mediators and how synapse load \
classes?<br><br></div><div>Basically if that provides hot update/deploy that is \
fine.<br>






</div><div><br></div><div>thanks,<br></div><div>Amila. <br></div><div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">


<div><br></div><div>Regards,</div><div>Udayanga</div></div><div \
class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Sun, Apr 7, 2013 at \
6:01 AM, Amila Suriarachchi <span dir="ltr">&lt;<a \
href="mailto:amilasuriarachchi@gmail.com" \
target="_blank">amilasuriarachchi@gmail.com</a>&gt;</span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div \
dir="ltr"><div><div><div><div>hi,<br></div><div><br></div>Currently Synapse custom  \
mediators has to deploy as a jar and should be available at the server  starts up \
time. But there are situations we need to hot update/deploy  these custom mediators. \
<br> <br></div>Can we have a method like in .aar files where we bundle 
synapse mediators as an archive file possibly with a descriptor file and
 make it hot update deploy?<br><br></div>thanks,<br></div>Amila.<span><font \
color="#888888"><span><font color="#888888"><br clear="all"><div> \
<div><div><div><div><br></div></div></div></div></div></font></span><br \
clear="all"><br>-- <br>Amila Suriarachchi<br>WSO2 Inc.<br>blog: <a \
href="http://amilachinthaka.blogspot.com/" \
target="_blank">http://amilachinthaka.blogspot.com/</a> </font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font \
color="#888888">-- <br><a href="http://www.udayangawiki.blogspot.com" \
target="_blank">http://www.udayangawiki.blogspot.com</a> </font></span></div>
</blockquote></div></div><div><br><br clear="all"><br>-- <br>Amila \
Suriarachchi<br>WSO2 Inc.<br>blog: <a href="http://amilachinthaka.blogspot.com/" \
target="_blank">http://amilachinthaka.blogspot.com/</a> </div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font \
color="#888888">-- <br><a href="http://www.udayangawiki.blogspot.com" \
target="_blank">http://www.udayangawiki.blogspot.com</a> </font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font \
color="#888888">-- <br>Kasun Indrasiri<br><span \
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Associate \
Technical Lead</span>,<br>



WSO2 Inc. - &quot;Lean . Enterprise . Middleware&quot; - <a \
href="http://www.wso2.com/" target="_blank">http://www.wso2.com/</a><br> Blog : <a \
href="http://kasunpanorama.blogspot.com/" \
target="_blank">http://kasunpanorama.blogspot.com/</a><br> </font></span></div>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><a href="http://www.udayangawiki.blogspot.com" \
target="_blank">http://www.udayangawiki.blogspot.com</a> \
</font></span></div></div></div> </blockquote></div><br><br \
clear="all"><div><br></div>-- <br>Kasun Indrasiri<br><span \
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Associate \
Technical Lead</span>,<br>WSO2 Inc. - &quot;Lean . Enterprise . Middleware&quot; - <a \
href="http://www.wso2.com/" target="_blank">http://www.wso2.com/</a><br> Blog : <a \
href="http://kasunpanorama.blogspot.com/" \
target="_blank">http://kasunpanorama.blogspot.com/</a><br> </div>

--90e6ba61453a5dddaf04da392e59--


["synapse-core-2.2.0-SNAPSHOT.jar" (application/java-archive)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic