WARN io.netty.util.concurrent.DefaultPromise - An exception was thrown by io.vertx.core.net.impl.ChannelProvider$$Lambda$219/1676533407.operationComplete()java.lang.IllegalStateException: Uh oh! Event loop context executing with wrong thread! Expected null got Thread[globalEventExecutor-1-78,5,main] at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:316) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:193) at io.vertx.core.http.impl.ConnectionManager$ConnQueue.connectionFailed(ConnectionManager.java:362) at io.vertx.core.http.impl.ConnectionManager$ConnQueue.access$1900(ConnectionManager.java:194) at io.vertx.core.http.impl.ConnectionManager$ChannelConnector.lambda$connect$2(ConnectionManager.java:528) at io.vertx.core.net.impl.ChannelProvider.lambda$connect$0(ChannelProvider.java:42) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:481) at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:34) at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:431) at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:233) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) at java.lang.Thread.run(Thread.java:748)
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/SSnbEG3AGJA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/b39d58b9-d6b3-44b2-b966-027428d4fc7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
executor.submit( () -> {
// Get the message
sen
vertx.getOrCreateContext().runOnContext(v -> callback.handle(message.getBody()));
.
});
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4fa05efa-878f-438a-a190-8146d30c6da8%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/134834c5-2a8c-4f4f-980c-da32aecb3813%40googlegroups.com.
private Map<String, ExecutorService> consumerThreadsMap = new ConcurrentHashMap<>();
private Context currentContext;
private numOfConsumerThreads;
public void init() { currentContext = vertx.getOrCreateContext();}
public void consume(String address, int numOfConsumerThreads, Handler<String> callback) {
ExecutorService executor = getOrCreateExecutor(address, numOfConsumerThreads);
for (int i = 0; i < numOfConsumerThreads; i++) { Thread.currentThread().setName("vert.x-sqs-consumer-thread-" + i); executor.submit(() -> { while (!Thread.currentThread().isInterrupted()) { try { List<Message> messages = gatherMessages(envAndQueueAddress); if (messages != null && messages.size() > 0) { messages.forEach(message -> currentContext.runOnContext(v -> callback.handle(message.getBody()));); } } catch (Exception e) { log.error("EventQueueSQS, Error inside consuming loop(Continuing to loop). ", e); } } }); } }
private ExecutorService getOrCreateExecutor(String address, int numOfConsumerThreads) { ExecutorService executor = consumerThreadsMap.get(address); if (executor == null) { executor = Executors.newFixedThreadPool(numOfConsumerThreads); consumerThreadsMap.put(address, executor); } return consumerThreadsMap.get(address); }
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/9cdbef4d-2bc5-4d49-b46c-2c453441ab77%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c29d28fb-843a-4ebf-a94b-86c9dcc36c37%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/41b157b4-86b0-4b26-853e-ed3b6bf53d03%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/aae083bc-02ab-4b1c-b43f-02555f19b704%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/23addea2-09c3-4078-9730-2dace0cf4abf%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c164eec4-6ff6-4694-aeb9-22863f7fb410%40googlegroups.com.