Datomic Ion Lifecycle Events or Hooks

Is it possible to hook into application lifecycle events in Datomic Ion.

I want to manage the lifecycle of a service or pool of external database connections on startup / shutdown.

Are there hooks or events that I can use? If not, what’s a good approach to this?

1 Like

It should possible to hook into deployment events in Datomic Ions. You can create an EventBridge event for each step in the CodeDeploy deployment and trigger a Lambda function. I’ve done that before without an issue.

However, if you just want to execute a function to create connections, you can just place that function in one of the namespaces that gets loaded into your Ions application. As soon as Datomic loads your namespace, the function will be executed. Here you can see my answer about starting a background thread to poll from a queue when the Datomic application is started. It could give an idea about how to implement in your case.

1 Like