hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource?

Jeff Mesnil
I am working on an issue[1] and I am not sure what is the best way to tackle it.

TL;DR

I need to find a way to hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource.
Once this state is reached, I need to perform the ADD operations.

---

HornetQ server can be started in *backup* mode for failover.
When it is configured to be a backup, HornetQ will start but remain passive: it does not open any sockets or create resources (such a JMS objects). It just waits for a live node failure to become active. Once it detects the live node failure, it will activate, accept connections and create all its resources.

The issue I am working on is to fix the discrepancy between AS7 management resource for HornetQ and its underlying runtime resources.
When HornetQ is started by the AS7 messaging subsystem in backup mode, we also create all the hornetq-server's children resources even though the corresponding HornetQ objects are not available.
As soon as the user interacts with them, it fails because the runtime operation can not be processed by HornetQ.

I can maybe fix this by checking whether the underlying HornetQ resource is available before using it but that'd not be enough.
For example, what'd happen if another service depends on a JMS Queue service that is installed and active but not operational because HornetQ has not loaded the JMS queue resource?

Instead, I'd like to fix this at the level of hornetq-server resource: if the server is passive, no children resource is available in AS7 management model.
Once it becomes active, AS7 resources become available too.

In any case, I create the hornetq-server resource and start the underlying HornetQ server.
If the server is in backup mode, I don't want to add any underlying children resources to AS7 management model. That means that all ADD operations for hornetq-server children will have to check on HornetQ server runtime state to know whether the AS7 resource must be created or not.
Once it becomes active (HornetQ provides a callback API to be notified), HornetQ will create all the underlying HornetQ objects. But I now need to update the AS7 management model by creating the corresponding resources and perform some runtime operations too (e.g. to create a JMS Queue service that can be depended upon).

Do we have subsystems doing such mumbo jumbo trick?
This seems a convoluted way to fix this issue but I have not any other idea at the moment...

jeff


[1] https://issues.jboss.org/browse/AS7-6699

--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource?

Brian Stansberry
The management resources do exist though. They represent configuration,
which exists and needs to be manageable.

Is the problem with the various runtime-only attributes and operations
that are exposed by the resources? There's no mechanism to hide those in
the API or flag that they are unavailable if some condition doesn't hold
(e.g.  some new attribute 'active' == true)?

On 3/13/13 6:03 AM, Jeff Mesnil wrote:

> I am working on an issue[1] and I am not sure what is the best way to tackle it.
>
> TL;DR
>
> I need to find a way to hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource.
> Once this state is reached, I need to perform the ADD operations.
>
> ---
>
> HornetQ server can be started in *backup* mode for failover.
> When it is configured to be a backup, HornetQ will start but remain passive: it does not open any sockets or create resources (such a JMS objects). It just waits for a live node failure to become active. Once it detects the live node failure, it will activate, accept connections and create all its resources.
>
> The issue I am working on is to fix the discrepancy between AS7 management resource for HornetQ and its underlying runtime resources.
> When HornetQ is started by the AS7 messaging subsystem in backup mode, we also create all the hornetq-server's children resources even though the corresponding HornetQ objects are not available.
> As soon as the user interacts with them, it fails because the runtime operation can not be processed by HornetQ.
>
> I can maybe fix this by checking whether the underlying HornetQ resource is available before using it but that'd not be enough.
> For example, what'd happen if another service depends on a JMS Queue service that is installed and active but not operational because HornetQ has not loaded the JMS queue resource?
>
> Instead, I'd like to fix this at the level of hornetq-server resource: if the server is passive, no children resource is available in AS7 management model.
> Once it becomes active, AS7 resources become available too.
>
> In any case, I create the hornetq-server resource and start the underlying HornetQ server.
> If the server is in backup mode, I don't want to add any underlying children resources to AS7 management model. That means that all ADD operations for hornetq-server children will have to check on HornetQ server runtime state to know whether the AS7 resource must be created or not.
> Once it becomes active (HornetQ provides a callback API to be notified), HornetQ will create all the underlying HornetQ objects. But I now need to update the AS7 management model by creating the corresponding resources and perform some runtime operations too (e.g. to create a JMS Queue service that can be depended upon).
>
> Do we have subsystems doing such mumbo jumbo trick?
> This seems a convoluted way to fix this issue but I have not any other idea at the moment...
>
> jeff
>
>
> [1] https://issues.jboss.org/browse/AS7-6699
>


--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource?

Jeff Mesnil

Le 13 mars 2013 à 18:43, Brian Stansberry <[hidden email]> a écrit :

> The management resources do exist though. They represent configuration,
> which exists and needs to be manageable.
>
> Is the problem with the various runtime-only attributes and operations
> that are exposed by the resources? There's no mechanism to hide those in
> the API or flag that they are unavailable if some condition doesn't hold
> (e.g.  some new attribute 'active' == true)?

yes, that's simpler this way: for each runtime attr and operations, I check whether the underlying hornetq server is active.
if that's not the case, I ignore the read-attribute (returning undefined) and fail the operations.

I also have to make sure that AS7 service depending on HornetQ (topic, queue and cf services) are not started until it becomes active.
I install them in NEVER mode and switch them to ACTIVE if HornetQ server fails over and becomes active.

thanks,
jeff

--
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: hold off ADDing AS7 children resources to another resource until a runtime state is reached for this resource?

Brian Stansberry
On 3/14/13 9:55 AM, Jeff Mesnil wrote:

>
> Le 13 mars 2013 à 18:43, Brian Stansberry <[hidden email]> a écrit :
>
>> The management resources do exist though. They represent configuration,
>> which exists and needs to be manageable.
>>
>> Is the problem with the various runtime-only attributes and operations
>> that are exposed by the resources? There's no mechanism to hide those in
>> the API or flag that they are unavailable if some condition doesn't hold
>> (e.g.  some new attribute 'active' == true)?
>
> yes, that's simpler this way: for each runtime attr and operations, I check whether the underlying hornetq server is active.
> if that's not the case, I ignore the read-attribute (returning undefined) and fail the operations.
>

For AS 9 we need to figure out how to represent this in the metadata,
particularly for the operations.

One thing we've done is registering overrides in the
ManagementResourceRegistration. So, the registration for hornetqserver=*
includes no runtime stuff and then when a specific resource becomes
live, an override registration for hornetqserver=specific_name is done
that exposes all the runtime stuff.

It's pretty nasty though. I don't think we should try and apply that
technique to this case.

> I also have to make sure that AS7 service depending on HornetQ (topic, queue and cf services) are not started until it becomes active.
> I install them in NEVER mode and switch them to ACTIVE if HornetQ server fails over and becomes active.
>
> thanks,
> jeff
>


--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev