运行 调用线程中的 Hazelcast put() 和 replace() 调用
Running Hazelcast put() and replace() calls in the calling thread
是否可以在调用线程的 TransactionalMap 上强制 Hazelcast 运行 put()、replace() 和 delete() 方法?我希望 XA 事务从写入 Hazelcast 转移到写入 MapStore 中的数据库,但 Hazelcast 正在排队更改 运行 在其他线程上,因此它们不在同一事务上下文中。
我已将它设置为直写持久性,但我看到它正在排队 TxnSetOperation 并 运行将它们放在单独的线程上。
这是一个 Spring 启动应用程序,使用 Hazelcast 自动配置和支持 PostgreSQL 的 JPA/Hibernate 存储。
MapStore
操作不在同一事务上下文中 运行。如果您希望使用 Hazelcast 进行事务性持久更新,则需要使用 XA 事务并且不启用 MapStore
。然后您可以在您的上下文中将持久存储设置为不同的 XA 资源。您可以查看 Hazelcast 参考手册中的相关部分:http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#providing-xa-transactions
Alsparlan 的回答部分正确,但无法在 MapStore 中使用与您针对 Hazelcast TransactionalMap 执行的操作相同的事务上下文来获取资源。他提供的 link 没有谈论这个(不幸的是),但 Javadoc for TransactionalMap 确实:
When using MapStore, the call to any MapStore method is outside the transactional boundary. If you need to have an XATransaction spanning Hazelcast operations and one more other XAResources (such as a database), you should not use MapStore. Instead, enlist both resources in a transaction
我已经删除了我的 MapStore 使用并将我的 Spring 启动存储库直接连接到我的服务中,这样我就可以在同一事务中以相同的服务方法对 Hazelcast 和我的数据源进行更改。连同 以声明方式征用 Hazelcast XAResource,这现在对我有用。
是否可以在调用线程的 TransactionalMap 上强制 Hazelcast 运行 put()、replace() 和 delete() 方法?我希望 XA 事务从写入 Hazelcast 转移到写入 MapStore 中的数据库,但 Hazelcast 正在排队更改 运行 在其他线程上,因此它们不在同一事务上下文中。
我已将它设置为直写持久性,但我看到它正在排队 TxnSetOperation 并 运行将它们放在单独的线程上。
这是一个 Spring 启动应用程序,使用 Hazelcast 自动配置和支持 PostgreSQL 的 JPA/Hibernate 存储。
MapStore
操作不在同一事务上下文中 运行。如果您希望使用 Hazelcast 进行事务性持久更新,则需要使用 XA 事务并且不启用 MapStore
。然后您可以在您的上下文中将持久存储设置为不同的 XA 资源。您可以查看 Hazelcast 参考手册中的相关部分:http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#providing-xa-transactions
Alsparlan 的回答部分正确,但无法在 MapStore 中使用与您针对 Hazelcast TransactionalMap 执行的操作相同的事务上下文来获取资源。他提供的 link 没有谈论这个(不幸的是),但 Javadoc for TransactionalMap 确实:
When using MapStore, the call to any MapStore method is outside the transactional boundary. If you need to have an XATransaction spanning Hazelcast operations and one more other XAResources (such as a database), you should not use MapStore. Instead, enlist both resources in a transaction
我已经删除了我的 MapStore 使用并将我的 Spring 启动存储库直接连接到我的服务中,这样我就可以在同一事务中以相同的服务方法对 Hazelcast 和我的数据源进行更改。连同