Skip to content

Execute Java Code at PostgreSQL startup to "Get Things Ready" #492

@TasMot

Description

@TasMot

I am developing with Drools (A Business Rules Management System). The startup of each rule service is a two part process. The first step is to instantiate a "container". This step does a lot of the heavy lifting to get a rule service ready. Then, the second step is to get a "session" and utilize the rule service to make a decision based on the rules. What I want to do is to instantiate the container during the startup of PostgreSQL. Then when an insert/update/delete trigger is executed, get a session and make a decision.

Instantiating a container is a heavy weight process and is expensive and time-consuming to do for each trigger. Also, in some cases, the container maintains a state that is meaningful to the decision making process.

At this point, I have gotten a trigger to invoke the rule service but each time it has to instantiate a container, get a session, make a decision and then throw everything away when the Java Trigger Class goes out of scope.

Since everything is invoked via Java, I was wondering if there is any way to invoke a Java Class during the startup of PostgreSQL so that one or more containers can be instantiated and made available to trigger executions. I'm sure that there are more details needed to actually make this work but I'm curious about whether the general concept is available first.
Thanks,
Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions