Testing Connector replacing in-memory connector - #3506
Open
ozangunalp wants to merge 2 commits into
Open
Conversation
ozangunalp
force-pushed
the
testing_connector
branch
from
August 25, 2026 11:04
fc3570d to
149e6e0
Compare
Add connector-aware EmitterFactory API so connector-specific emitters (KafkaTransactions, PulsarTransactions, KafkaRequestReply, AmqpRequestReply, RabbitMQRequestReply) work with non-native connectors like the test connector. When a channel's connector differs from what the emitter factory expects, the framework calls createFallbackEmitter() to produce a no-op implementation that sends messages through the standard emitter path without requiring a real broker. Also rename the in-memory connector to TestingConnector (smallrye-testing) with new TestIncoming/TestOutgoing interfaces using deliver()/sent() methods. Old InMemoryConnector/InMemorySource/InMemorySink classes are deprecated but remain fully functional for backward compatibility.
…essaging-testing The old artifact ID is preserved as a relocation POM that pulls in the new artifact transitively. Existing consumers will get a Maven warning and continue to work.
ozangunalp
force-pushed
the
testing_connector
branch
from
August 25, 2026 11:33
149e6e0 to
f787cea
Compare
cescoffier
requested changes
Sep 4, 2026
| try { | ||
| NoOpTransactionalEmitter emitter = new NoOpTransactionalEmitter(); | ||
| return work.apply(emitter) | ||
| .call(() -> emitter.waitOnSends()) |
Contributor
There was a problem hiding this comment.
The Kafka no-op (NoOpKafkaTransactionsImpl) checks emitter.isMarkedForAbort() after the work function completes and throws TransactionAbortedException if set. The Pulsar variant does nothing.
// In Kafka
return work.apply(emitter)
.call(() -> emitter.waitOnSends())
.chain(result -> {
if (emitter.isMarkedForAbort()) {
return Uni.createFrom().failure(new TransactionAbortedException());
}
return Uni.createFrom().item(result);
})
.eventually(activeTransactions::decrementAndGet);
// In Pulsar (missing abort check)
return work.apply(emitter)
.call(() -> emitter.waitOnSends())
.eventually(activeTransactions::decrementAndGet); // <-- no abort checkShould it be symmetric?
| public <M extends Message<? extends T>> void send(TransactionalEmitter<?> emitter, M msg) { | ||
| sendMessage(msg).subscribe().with(unused -> { | ||
| }, throwable -> { | ||
| }); |
Contributor
There was a problem hiding this comment.
Maybe at least a warning?
| */ | ||
| @Deprecated(forRemoval = true) | ||
| public static void clear() { | ||
| List<String> list = System.getProperties().entrySet().stream() |
Contributor
There was a problem hiding this comment.
@Deprecated(forRemoval = true)
public static void clear() {
TestingConnector.clear();
}| final Flow.Publisher<? extends Message<T>> source; | ||
| private final String name; | ||
| private final Context context; | ||
| private boolean runOnVertxContext; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InMemoryConnectorand existing API are deprecated but functional.TestingConnectorkeeps the overall behaviour but renames method names for easier API ergonomics:incomingreturnsTestIncomingchannel that allowsdelivering in messages to the application channel.outgoingreturnsTestOutgoingchannel that allows verifyingsentmessages.Addresses #3104