Skip to content

Share connection between ActiveRecord and Eventide Session #12

@sbellware

Description

@sbellware

Update (Mon Oct 29 2019):

A conversation with @aaronjensen triggered the realization that this would be easier (and likely a better design) if an implementation of MessageStore::Postgres::Session were build that is constructed with an ActiveRecord connection, and that respects the Session's interface and semantics. If that's feasible, then that session can be injected into any Eventide primitive (eg: a writer) that accepts a session.


Enables writing to ActiveRecord and message store in an atomic transaction.

The MessageStore::Postgres::Session would have to be redesigned so that it could be built around an existing connection, rather than constructing its own. The connection and transaction lifecycle could likely also not be managed by the session.

This type of Session object may need to be an entirely separate implementation. Inevitably, it would necessitate the initiation of a new and separate library that compartmentalizes all of the ActiveRecord concerns and isolates the rest of the toolkit from any of the invidious effects of integrating with ActiveRecord.

Research work needed:

  • The connection and its transaction authority extended to the Eventide session must absolutely be the same one that is in use within the Rails applicative code that is actuating the Eventide session. If it's not, then the goal of atomicity will not be achieved.
  • Gain access to a raw PG connection (from the PG gem) so that it can be assigned to an Eventide Session. It must be the connection object from the PG gem, as this is the interface that the Eventide Session interacts with. It must be confirmed that the PG adapter for ActiveRecord uses the PG gem.
  • Ensure that ActiveRecord can remain in control of the connection lifecycle, and that opportunities to leak the connection are neutralized

Supporting Material:

Metadata

Metadata

Assignees

No one assigned

    Labels

    considerationPotential to be an improvement or feature but needs more thought.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions