On 8/22/2012 7:04 PM, Brett Palmer wrote:
*Adrian,
I’ve updated to the latest ofbiz code (revision 1374598) and trying to
setup our code to use the new changes to the service engine and job poller.
Here are a few questions:
1. Instantiating a new dispatcher to run a service.
We use to instantiate a LocalDispatcher to run a service with the following
code:
LocalDispatcher olapDispatcher =
GenericDispatcher.getLocalDispatcher(“some dispatcher Name”, olapDelegator);
Now it looks like we have a Factor object that creates the dispatcher if
one is not already created with that name. The method is
createLocallDispatcher but its not a static method and so a
GenericDispatcherFactory needs to be instantiated first.
LocalDispatcher olapDispatcher =
GenericDispatcherFactory.createLocalDispatcher(dbConfig, olapDelegator);
How should I be instantiating the GenericDispatcherFactory or is there
preferred way to run a service from code?
ServiceContainer.getLocalDispatcher(...)
2. Is the “wait-millis” attribute still required? The service-config.xsd
still lists it as a required attribute for thread-pool but I don’t see it
reference anywhere in the code. If it is needed how does it work?
It is not used. The schema has been updated to reflect that - make sure
you are looking at the service-config.xsd file in your local copy.
3. If I understand the service configuration file, it looks like I can
configure the service engine to work against multiple pools (see example
config below). If I wanted to run some services in specific pools can I
use the LocalDispatcher.scedule() method and just have an immediate time to
run but specify the pool I want them to use.
Correct. Just remember the multiple pools share a delegator, so they are
all in the same data source.
We need this functionality for our data warehouse processing. We try to
provide real time reports but our database cannot handle a high number of
data warehouse updates during heavy loads. By configuring only one server
to service a particular pool we can limit the number of concurrent
processes running those services.
<thread-pool send-to-pool="pool"
purge-job-days="4"
failed-retry-min="3"
ttl="120000"
jobs="100"
min-threads="2"
max-threads="5"
wait-millis="1000"
poll-enabled="true"
poll-db-millis="30000">
<run-from-pool name="pool"/>
<run-from-pool name="dwPool"/>
</thread-pool>
That configuration will work. That server will service the two pools.
Thanks in advance for your help. I’ll continue to test the new
configuration as soon as I can get these answers.
Thank you taking the time to test this. I have a client requirement
similar to yours, but on a smaller scale - so I am very interested in
how it all works out.
-Adrian