Skip to content

Instantly share code, notes, and snippets.

View danielkec's full-sized avatar
🚀

Daniel Kec danielkec

🚀
View GitHub Profile
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setURL("jdbc:oracle:thin:@localhost:1521:XE");
pds.setUser("frank");
pds.setPassword("frank");
AqConnector seConn = AqConnector.builder()
.dataSource("test-ds", pds)
.build();
// Manually define JMS connection factory
ActiveMQConnectionFactory connectionFactory =
new ActiveMQConnectionFactory("tcp://192.168.0.123:61616");
// Setup connector
JmsConnector seConn = JmsConnector.builder()
.connectionFactory("jms-con-1", connectionFactory)
.build();
// Prepare channels
// Setup connector
JmsConnector seConn = JmsConnector.create();
// Prepare channels
Channel<String> toJms = Channel.<String>builder()
.name("to-jms")
.subscriberConfig(JmsConnector.configBuilder()
.queue("example_queue_1")
.jndiInitialFactory(ActiveMQInitialContextFactory.class)
.jndiProviderUrl("tcp://192.168.0.123:61616")
<dependency>
<groupId>io.helidon.messaging.jms</groupId>
<artifactId>helidon-messaging-jms</artifactId>
</dependency>
<!-- JMS client implenting JMS api of your choice-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>
// Setup connector
JmsConnector seConn = JmsConnector.create();
// Prepare channels
Channel<String> toJms = Channel.create("to-jms");
Channel<String> fromJms = Channel.create("from-jms");
// Prepare emitter for interaction with non-reactive code
Emitter<String> emitter = Emitter.create(toJms);
javax:
sql:
DataSource:
local-example-ds:
connectionFactoryClassName: oracle.jdbc.pool.OracleDataSource
URL: jdbc:oracle:thin:@localhost:1521:XE
user: frank
password: frank
mp:
<dependency>
<groupId>io.helidon.microprofile.messaging</groupId>
<artifactId>helidon-microprofile-messaging</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.messaging.aq</groupId>
<artifactId>helidon-messaging-aq</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
@Outgoing("to-aq")
public Publisher<String> toAq() {
return FlowAdapters.toPublisher(
Multi.interval(2, TimeUnit.SECONDS, Executors.newSingleThreadScheduledExecutor())
.map(i -> "Message " + i)
);
}
@Incoming("from-aq")
private AtomicInteger counter = new AtomicInteger();
@Incoming("from-aq")
@Acknowledgment(Acknowledgment.Strategy.MANUAL)
public CompletionStage<?> fromAq(AqMessage<String> msg) {
System.out.println("Received: " + msg.getPayload());
if (counter.getAndIncrement() == 5) {
throw new RuntimeException("5th message exception!");
}
//Acknowledgement/commit is called after the business code
create user frank identified by SuperSecretPassword1234;
grant connect to frank;
grant resource to frank;
grant execute on dbms_aq to frank;
grant execute on dbms_aqadm to frank;
grant execute on dbms_aqin to frank;
grant unlimited tablespace to frank;
BEGIN