forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#14351 from gwenneg/issue-14333-artemis-j…
…ms-npe Produce Artemis JMS connection factory as a synthetic bean
- Loading branch information
Showing
3 changed files
with
28 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
32 changes: 0 additions & 32 deletions
32
.../artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsProducer.java
This file was deleted.
Oops, something went wrong.
16 changes: 13 additions & 3 deletions
16
.../artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
package io.quarkus.artemis.jms.runtime; | ||
|
||
import io.quarkus.arc.runtime.BeanContainer; | ||
import java.util.function.Supplier; | ||
|
||
import javax.jms.ConnectionFactory; | ||
|
||
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; | ||
|
||
import io.quarkus.artemis.core.runtime.ArtemisRuntimeConfig; | ||
import io.quarkus.runtime.annotations.Recorder; | ||
|
||
@Recorder | ||
public class ArtemisJmsRecorder { | ||
|
||
public void setConfig(ArtemisRuntimeConfig config, BeanContainer container) { | ||
container.instance(ArtemisJmsProducer.class).setConfig(config); | ||
public Supplier<ConnectionFactory> getConnectionFactorySupplier(ArtemisRuntimeConfig config) { | ||
return new Supplier<ConnectionFactory>() { | ||
@Override | ||
public ConnectionFactory get() { | ||
return new ActiveMQJMSConnectionFactory(config.url, config.username.orElse(null), config.password.orElse(null)); | ||
} | ||
}; | ||
} | ||
} |