kandi background
Explore Kits

smallrye-reactive-streams-operators | Implementation of the MicroProfile Reactive | Reactive Programming library

 by   smallrye Java Version: Current License: Apache-2.0

 by   smallrye Java Version: Current License: Apache-2.0

Download this library from

kandi X-RAY | smallrye-reactive-streams-operators Summary

smallrye-reactive-streams-operators is a Java library typically used in Programming Style, Reactive Programming applications. smallrye-reactive-streams-operators has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. However smallrye-reactive-streams-operators has 2 bugs. You can download it from GitHub, Maven.
Implementation of the MicroProfile Reactive Streams Operators specification
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • smallrye-reactive-streams-operators has a low active ecosystem.
  • It has 20 star(s) with 10 fork(s). There are 12 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 0 open issues and 25 have been closed. On average issues are closed in 27 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of smallrye-reactive-streams-operators is current.
This Library - Support
Best in #Reactive Programming
Average in #Reactive Programming
This Library - Support
Best in #Reactive Programming
Average in #Reactive Programming

quality kandi Quality

  • smallrye-reactive-streams-operators has 2 bugs (0 blocker, 0 critical, 2 major, 0 minor) and 100 code smells.
This Library - Quality
Best in #Reactive Programming
Average in #Reactive Programming
This Library - Quality
Best in #Reactive Programming
Average in #Reactive Programming

securitySecurity

  • smallrye-reactive-streams-operators has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • smallrye-reactive-streams-operators code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
This Library - Security
Best in #Reactive Programming
Average in #Reactive Programming
This Library - Security
Best in #Reactive Programming
Average in #Reactive Programming

license License

  • smallrye-reactive-streams-operators is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
This Library - License
Best in #Reactive Programming
Average in #Reactive Programming
This Library - License
Best in #Reactive Programming
Average in #Reactive Programming

buildReuse

  • smallrye-reactive-streams-operators releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • It has 5747 lines of code, 410 functions and 151 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
This Library - Reuse
Best in #Reactive Programming
Average in #Reactive Programming
This Library - Reuse
Best in #Reactive Programming
Average in #Reactive Programming
Top functions reviewed by kandi - BETA

kandi has reviewed smallrye-reactive-streams-operators and discovered the below as its top functions. This is intended to give you an instant insight into smallrye-reactive-streams-operators implemented functionality, and help decide if they suit your requirements.

  • Runs the upstream .
  • Collects elements of this Stream
  • Start event handler .
  • Build a publisher for the given graph .
  • Creates a Flowable from a CompletionStage .
  • The comparison operator .
  • Manually manage a subscribe in the current state .
  • On failure .
  • Loads the engine .
  • The main method .

smallrye-reactive-streams-operators Key Features

Implementation of the MicroProfile Reactive Streams Operators specification

How to build

copy iconCopydownload iconDownload
mvn clean install

How to execute JPA Entity manager operations inside Quarkus-Kafka consumer method

copy iconCopydownload iconDownload
@Transactional
@Incoming("new-payment")
public CompletionStage<?> updateTotalBuyers(Message<String> paymentEvent) {

    //TODO: move to CDI producer
    ManagedExecutor executor = ManagedExecutor.builder()
            .maxAsync(5)
            .propagated(ThreadContext.CDI, 
                        ThreadContext.TRANSACTION)
            .build();
    //TODO: move to CDI producer
    ThreadContext threadContext = ThreadContext.builder()
                     .propagated(ThreadContext.CDI, 
                                 ThreadContext.TRANSACTION)
                     .build();

    return executor.runAsync(threadContext.contextualRunnable(() -> {
        try {
            log.info("Into update total buyers");
            PaymentEvent event = jsonb.fromJson(paymentEvent.getPayload(), PaymentEvent.class);
            Book book = Book.find("isbn", event.getIsbn()).singleResult();
            book.totalBuyers++;
            book.persist();
            log.info("Total books {}", book.totalBuyers);
        } catch(Exception e) {
            log.error("Something wrong happened !!!", e);
        } finally {
            paymentEvent.ack();
        }
    }));
}
-----------------------
private final ExecutorService scheduler  = Executors.newSingleThreadExecutor();
scheduler.submit(/*MyRunnable*/)
@Inject
ManagedExecutor managedExecutor;
managedExecutor.submit(/*MyRunnable*/);
ManagedExecutor executor = ManagedExecutor.builder()
        .maxAsync(5)
        .propagated(ThreadContext.CDI, 
                    ThreadContext.TRANSACTION)
        .build();
//TODO: move to CDI producer
ThreadContext threadContext = ThreadContext.builder()
                 .propagated(ThreadContext.CDI, 
                             ThreadContext.TRANSACTION)
                 .build();
-----------------------
private final ExecutorService scheduler  = Executors.newSingleThreadExecutor();
scheduler.submit(/*MyRunnable*/)
@Inject
ManagedExecutor managedExecutor;
managedExecutor.submit(/*MyRunnable*/);
ManagedExecutor executor = ManagedExecutor.builder()
        .maxAsync(5)
        .propagated(ThreadContext.CDI, 
                    ThreadContext.TRANSACTION)
        .build();
//TODO: move to CDI producer
ThreadContext threadContext = ThreadContext.builder()
                 .propagated(ThreadContext.CDI, 
                             ThreadContext.TRANSACTION)
                 .build();
-----------------------
private final ExecutorService scheduler  = Executors.newSingleThreadExecutor();
scheduler.submit(/*MyRunnable*/)
@Inject
ManagedExecutor managedExecutor;
managedExecutor.submit(/*MyRunnable*/);
ManagedExecutor executor = ManagedExecutor.builder()
        .maxAsync(5)
        .propagated(ThreadContext.CDI, 
                    ThreadContext.TRANSACTION)
        .build();
//TODO: move to CDI producer
ThreadContext threadContext = ThreadContext.builder()
                 .propagated(ThreadContext.CDI, 
                             ThreadContext.TRANSACTION)
                 .build();

My Camel route app detects other app's published ampq message(?), but, fails to handle, with "no type converter available" error. How can I resolve?

copy iconCopydownload iconDownload
@Override
public void configure() throws IOException, InterruptedException {
    from("direct:proc")
        .convertBodyTo(String.class)
        .to("file:./target?fileName=values.txt&fileExist=append");
}

@Incoming("prices")
public Subscriber<String> sink() {
    return crss.subscriber("direct:proc", String.class);
}

Community Discussions

Trending Discussions on smallrye-reactive-streams-operators
  • How to execute JPA Entity manager operations inside Quarkus-Kafka consumer method
  • My Camel route app detects other app's published ampq message(?), but, fails to handle, with "no type converter available" error. How can I resolve?
Trending Discussions on smallrye-reactive-streams-operators

QUESTION

How to execute JPA Entity manager operations inside Quarkus-Kafka consumer method

Asked 2020-Apr-16 at 10:26

Dears, I want to update my domain entities according to message being received by Kafka topic. I am using Quarkus latest and Smallrye reactive messaging with Kafka. Pub-sub model is working fine with me, but in consumer method I am unable to update my entities using entityManager or HibernatePanache.

Whenever I try to use entityManager code inside consumer message, an exception is being thrown and handled silently. Here is my consumer code :

@Transactional
@Incoming("new-payment")
public CompletionStage<Void> updateTotalBuyers(String paymentEvent) {
        return CompletableFuture.runAsync(() -> {
            PaymentEvent event = jsonb.fromJson(paymentEvent, PaymentEvent.class);
            TypedQuery<Book> query = em.createQuery("SELECT b FROM Book b where b.isbn=:isbn", Book.class);
            query.setParameter("isbn", event.getIsbn());
            Book book = query.getSingleResult();
            book.setTotalBuyers(book.getTotalBuyers() + 1);
            em.merge(book);
        });
    }

If anyone has a working code snippet for my problem it would be great. Also, how can I print that silent exception for further debugging ?

Update : I surrounded the code with try/catch block and the below exception is being thrown :

javax.enterprise.context.ContextNotActiveException: interface javax.enterprise.context.RequestScoped at io.quarkus.hibernate.orm.runtime.RequestScopedEntityManagerHolder_ClientProxy.arc$delegate(RequestScopedEntityManagerHolder_ClientProxy.zig:83) at io.quarkus.hibernate.orm.runtime.RequestScopedEntityManagerHolder_ClientProxy.getOrCreateEntityManager(RequestScopedEntityManagerHolder_ClientProxy.zig:191) at io.quarkus.hibernate.orm.runtime.entitymanager.TransactionScopedEntityManager.getEntityManager(TransactionScopedEntityManager.java:78) at io.quarkus.hibernate.orm.runtime.entitymanager.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:317) at io.quarkus.hibernate.orm.runtime.entitymanager.ForwardingEntityManager.createQuery(ForwardingEntityManager.java:142) at io.quarkus.hibernate.orm.panache.runtime.JpaOperations.find(JpaOperations.java:208) at io.quarkus.hibernate.orm.panache.runtime.JpaOperations.find(JpaOperations.java:200) at org.ibra.ebs.book.model.Book.find(Book.java) at org.ibra.ebs.book.service.BookService.lambda$updateTotalBuyers$0(BookService.java:106) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

I added annotation @ActivateRequestContext on both class and method with no luck.

Update : I tried to elevate context-propagation using

<dependency>
   <groupId>io.quarkus</groupId>
   <artifactId>quarkus-smallrye-reactive-streams-operators</artifactId>
</dependency>

Also same exception is being thrown with some context-propagation classes (which means it is being activated).

Regards.

ANSWER

Answered 2020-Jan-01 at 13:27

Add @ApplicationScoped and @ActivateRequestContext both these annotations on the class and @Transactional annotation on the updateTotalBuyers method.

Cheers!

Source https://stackoverflow.com/questions/58534957

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install smallrye-reactive-streams-operators

Check the Getting Started section from the documentation.
Quickstart project
Quickstart project with Vert.x
Quickstart project with Camel
To collect the code coverage:. The code coverage combines unit tests and TCK. The report is generated in the target/site/jacoco/index.html.

Support

Just open a pull request. Makes sure to run the tests and the TCK before opening the PR. Don't forget that documentation and tests are as important as the code (if not more). Please read the contribution guidelines for details, and the process for submitting pull requests.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Reactive Programming Libraries
Compare Reactive Programming Libraries with Highest Support
Compare Reactive Programming Libraries with Highest Quality
Compare Reactive Programming Libraries with Highest Security
Compare Reactive Programming Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.