You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "zhfeng (via GitHub)" <gi...@apache.org> on 2023/08/03 02:29:22 UTC

[GitHub] [camel-quarkus] zhfeng opened a new pull request, #5147: Revisit #4048 to Springless JPA extension

zhfeng opened a new pull request, #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147

   We get a chance to remove `transactionManager` in upstream `camel-jpa` and I revisit to introduce `QuarkusTransactionStrategy` and get removal of  `spring-orm` and `spring-tx` at all.
   
   Related upstream camel PR
   - https://github.com/apache/camel/pull/10954
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng merged pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng merged PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1663410439

   In general, I dislike having a lot of GraalVM substitutions on Camel code. If we can find ways in Camel to avoid such things in the future, then that would be my preferred way of doing things.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1667258976

   > @JiriOndrusek it seems there are still some dependencies updates?
   
   Hi, I'm checking it now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1667190965

   @JiriOndrusek it seems there are still some dependencies updates?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#discussion_r1282733844


##########
docs/modules/ROOT/pages/reference/extensions/jpa.adoc:
##########
@@ -50,8 +50,32 @@ endif::[]
 
 The extension leverages https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] to provide the JPA implementation via Hibernate.
 
-Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource,
+Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource.
+
+Also, it leverages https://quarkus.io/guides/transaction#programmatic-approach[Quarkus TX API] to provide `TransactionStrategy` implementation.

Review Comment:
   ```suggestion
   Also, it leverages https://quarkus.io/guides/transaction#programmatic-approach[Quarkus TX API] to provide a `TransactionStrategy` implementation.
   ```



##########
docs/modules/ROOT/pages/reference/extensions/jpa.adoc:
##########
@@ -50,8 +50,32 @@ endif::[]
 
 The extension leverages https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] to provide the JPA implementation via Hibernate.
 
-Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource,
+Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource.
+
+Also, it leverages https://quarkus.io/guides/transaction#programmatic-approach[Quarkus TX API] to provide `TransactionStrategy` implementation.
 
 When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a
-`EntityManagerFactory` and `TransactionManager`.
+`EntityManagerFactory` and `TransactionStrategy`.
+
+[id="extensions-jpa-configuration-configuring-jpamessageidrepository"]
+=== Configuring JpaMessageIdRepository
+It needs to use `EntityManagerFactory` and `TransactionStrategy` from the CDI container to configure the `JpaMessageIdRepository`:
+[source, java]
+----
+@Inject
+EntityManagerFactory entityManagerFactory;
+
+@Inject
+TransactionStrategy transactionStrategy;
+
+from("direct:idempotent")
+    .idempotentConsumer(
+        header("messageId"),
+        new JpaMessageIdRepository(entityManagerFactory, transactionStrategy, "idempotentProcessor"));
+----
+
+[NOTE]
+====
+Since it excludes the `spring-orm` dependency, some options such as `sharedEntityManager`, `transactionManager`  are not supported.

Review Comment:
   ```suggestion
   Since it excludes the `spring-orm` dependency, some options such as `sharedEntityManager`, `transactionManager` are not supported.
   ```



##########
docs/modules/ROOT/pages/reference/extensions/jpa.adoc:
##########
@@ -50,8 +50,32 @@ endif::[]
 
 The extension leverages https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] to provide the JPA implementation via Hibernate.
 
-Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource,
+Refer to the https://quarkus.io/guides/hibernate-orm[Quarkus Hibernate ORM] documentation to see how to configure Hibernate and your datasource.
+
+Also, it leverages https://quarkus.io/guides/transaction#programmatic-approach[Quarkus TX API] to provide `TransactionStrategy` implementation.
 
 When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a
-`EntityManagerFactory` and `TransactionManager`.
+`EntityManagerFactory` and `TransactionStrategy`.
+
+[id="extensions-jpa-configuration-configuring-jpamessageidrepository"]
+=== Configuring JpaMessageIdRepository
+It needs to use `EntityManagerFactory` and `TransactionStrategy` from the CDI container to configure the `JpaMessageIdRepository`:

Review Comment:
   ```suggestion
   To use `JpaMessageIdRepository` you must `@Inject` `EntityManagerFactory` and `TransactionStrategy` beans into your `RouteBuilder` and pass them to the `JpaMessageIdRepository`:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1663745191

   No problem, this was just a quock fix to make camel-main successful, Your complex change is taking care off it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1664887024

   @jamesnetherton I rasie a PR on upstream camel to do some refactor on `JpaComponent` and it could be helpful for the graal substition. I think we can only add some substitions like
   
   ```java
   @TargetClass(JpaEndpoint.class)
   final class JpaEndpointSubstitution {
       @Alias
       private TransactionStrategy transactionStrategy;
   
       @Substitute
       protected EntityManagerFactory createEntityManagerFactory() {
           throw new UnsupportedOperationException("createEntityManagerFactory is not supported");
       }
   
       @Substitute
       public TransactionStrategy getTransactionStrategy() {
           return transactionStrategy;
       }
   }
   
   @TargetClass(JpaComponent.class)
   final class JpaComponentSubstitution {
       @Substitute
       private void createTransactionStrategy() {
       }
   }
   
   @TargetClass(DefaultTransactionStrategy.class)
   @Delete
   final class DefaultTransactionStrategySubstitution {
   }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1668742223

   The failing tests look like unrelated so I'm going to merge.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1663698203

   Thanks @jamesnetherton for your reviewings and what you dislike is somthing in `JpaComponentSubstitution`?
   
   Yeah, I'm also thinking to do some refactors on camel-jpa.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1665301057

   @JiriOndrusek no problem and I still wait for the camel nightly build to include my fix of JpaComponent. Then I will take a look in the next week.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1665146351

   @zhfeng you might want to rebase to the current `camel-main` (if you want to trigger CI build again). some versions were updated and without the changes, the  CI build will fail early. (see https://github.com/apache/camel-quarkus/commit/71d0642c8e592533a8ed2cd3cbc154e56beff653)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1663710358

   @JiriOndrusek I'm very sorry that I have to revert your fix of JPA with https://github.com/apache/camel-quarkus/commit/256e2f9db81c0c5007e21933a5927a1a832ba0c7


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1667300841

   @zhfeng I updated the `camel-main` branch, would it be possible to rebase?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #5147: Revisit #4048 to Springless JPA extension

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #5147:
URL: https://github.com/apache/camel-quarkus/pull/5147#issuecomment-1667302625

   Sure. thanks @JiriOndrusek 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org