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/