users@glassfish.java.net

Re: How do I reconfigure a (JCA 1.6) resource adapter using the supportsDynamicUpdates property of the @ConfigProperty annotation without redeployment?

From: Jagadish Prasath Ramu <jagadish.ramu_at_oracle.com>
Date: Tue, 21 Jun 2011 23:20:39 +0530

Please find my responses in-line.


On Tue, 2011-06-21 at 13:40 +0200, Blank, Julius wrote:
> Hi there,
>
> I just wrote an inbound resource adapter that just opens a socket and
> waits for input on a specified port. The port itself is configurable
> so I annotated it as follows:
>
> @ConfigProperty(supportsDynamicUpdates = true)
> private Integer port = 12345;
>
> This way I could configure the port either through my message endpoint
> using the @MessageDrivenBean annotation with a
> @ActivationConfigProperty like so
>
> @MessageDriven (
> name = "MY_MDB",
> messageListenerInterface = SocketMessageEndpoint.class,
> activationConfig =
> {_at_ActivationConfigProperty(propertyName = "port", propertyValue =
> "54321")})
>
> if needed, otherwise I'll go with the default set above. (I could also
> use a deployment descriptor, but one message endpoint is sufficient
> for us).
>
> This works fine so far, but my problem is:
> We want to be able to change the port at runtime without redeploying
> the resource adapter (as this would require a redeploy of the client
> application as well).
AFAIK, it is not feasible.
>
> When I went through the JCA 1.6 spec I came across the
> supportsDynamicUpdates porperty but unfortunately I was unable to find
> any example nor a precise description of how to use that property. In
> other words: How can I dynamically update the property annotated this
> way?
eg:
When the config-property of ManagedConnectionFactory is updated,
application server can check whether the config-property
supportsDynamicUpdates. If it supports, instead
of re-configuring the connection pool, the MCF bean would be updated.
>
> And does glassfish 3.1 support this feature (the spec mentions that it
> is not an obligatory feature)?
Not yet available in GlassFish.
>
> I'd also love to know about other ways of updating bean properties of
> my resource adapter at runtime, so if you have an alternative idea,
> please let me know.
For the Resource Adapter Java Bean, you can create
resource-adapter-config
http://download.oracle.com/docs/cd/E18930_01/html/821-2433/create-resource-adapter-config-1.html

using which you can override the bean's properties. When you update the
resource-adapter-config, RAR will be re-configured.

Thanks,
-Jagadish
>
> If you need more information please let me know, I'll gladly provide
> you with what you need.
>
> Thanks in advance for help, best regards,
>
> Julius
>
> ----------------------------------------
> This message is intended for a particular addressee only and may
> contain business or company secrets. If you have received this email
> in error, please contact the sender and delete the message
> immediately. Any use of this email, including saving, publishing,
> copying, replication or forwarding of the message or the contents is
> not permitted.
>