Skip to content

Commit 3a6123f

Browse files
authored
[4.x] 6037 AQ connector @ConnectorAttribute (helidon-io#6038)
* 6037 AQ connector @ConnectorAttribute
1 parent c97e77c commit 3a6123f

2 files changed

Lines changed: 176 additions & 19 deletions

File tree

messaging/connectors/aq/src/main/java/io/helidon/messaging/connectors/aq/AqConnector.java

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,12 +26,113 @@
2626
import io.helidon.common.Builder;
2727
import io.helidon.common.configurable.ScheduledThreadPoolSupplier;
2828
import io.helidon.common.configurable.ThreadPoolSupplier;
29+
import io.helidon.messaging.connectors.jms.JmsConnector;
2930

31+
import org.eclipse.microprofile.reactive.messaging.spi.ConnectorAttribute;
3032
import org.eclipse.microprofile.reactive.messaging.spi.ConnectorFactory;
3133

3234
/**
3335
* Reactive Messaging Oracle AQ connector.
3436
*/
37+
@ConnectorAttribute(name = AqConnector.DATASOURCE_ATTRIBUTE,
38+
description = "name of the datasource bean used to connect Oracle DB with AQ",
39+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
40+
type = "string")
41+
@ConnectorAttribute(name = AqConnector.URL_ATTRIBUTE,
42+
description = "jdbc connection string used to connect Oracle DB with AQ (forbidden when datasource is specified)",
43+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
44+
type = "string")
45+
@ConnectorAttribute(name = JmsConnector.USERNAME_ATTRIBUTE,
46+
description = "User name used to connect JMS session",
47+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
48+
type = "string")
49+
@ConnectorAttribute(name = JmsConnector.PASSWORD_ATTRIBUTE,
50+
description = "Password to connect JMS session",
51+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
52+
type = "string")
53+
@ConnectorAttribute(name = JmsConnector.TYPE_ATTRIBUTE,
54+
description = "Possible values are: queue, topic",
55+
defaultValue = "queue",
56+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
57+
type = "string")
58+
@ConnectorAttribute(name = JmsConnector.DESTINATION_ATTRIBUTE,
59+
description = "Queue or topic name",
60+
mandatory = true,
61+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
62+
type = "string")
63+
@ConnectorAttribute(name = JmsConnector.ACK_MODE_ATTRIBUTE,
64+
description = "Possible values are: "
65+
+ "AUTO_ACKNOWLEDGE- session automatically acknowledges a client’s receipt of a message, "
66+
+ "CLIENT_ACKNOWLEDGE - receipt of a message is acknowledged only when Message.ack() is called manually, "
67+
+ "DUPS_OK_ACKNOWLEDGE - session lazily acknowledges the delivery of messages.",
68+
defaultValue = "AUTO_ACKNOWLEDGE",
69+
direction = ConnectorAttribute.Direction.INCOMING,
70+
type = "io.helidon.messaging.connectors.jms.AcknowledgeMode")
71+
@ConnectorAttribute(name = JmsConnector.TRANSACTED_ATTRIBUTE,
72+
description = "Indicates whether the session will use a local transaction.",
73+
mandatory = false,
74+
defaultValue = "false",
75+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
76+
type = "boolean")
77+
@ConnectorAttribute(name = JmsConnector.AWAIT_ACK_ATTRIBUTE,
78+
description = "Wait for the acknowledgement of previous message before pulling next one.",
79+
mandatory = false,
80+
defaultValue = "false",
81+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
82+
type = "boolean")
83+
@ConnectorAttribute(name = JmsConnector.MESSAGE_SELECTOR_ATTRIBUTE,
84+
description = "JMS API message selector expression based on a subset of the SQL92. "
85+
+ "Expression can only access headers and properties, not the payload.",
86+
mandatory = false,
87+
direction = ConnectorAttribute.Direction.INCOMING,
88+
type = "string")
89+
@ConnectorAttribute(name = JmsConnector.CLIENT_ID_ATTRIBUTE,
90+
description = "Client identifier for JMS connection.",
91+
mandatory = false,
92+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
93+
type = "string")
94+
@ConnectorAttribute(name = JmsConnector.DURABLE_ATTRIBUTE,
95+
description = "True for creating durable consumer (only for topic).",
96+
mandatory = false,
97+
defaultValue = "false",
98+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
99+
type = "boolean")
100+
@ConnectorAttribute(name = JmsConnector.SUBSCRIBER_NAME_ATTRIBUTE,
101+
description = "Subscriber name for durable consumer used to identify subscription.",
102+
mandatory = false,
103+
direction = ConnectorAttribute.Direction.INCOMING,
104+
type = "string")
105+
@ConnectorAttribute(name = JmsConnector.NON_LOCAL_ATTRIBUTE,
106+
description = "If true then any messages published to the topic using this session’s connection, "
107+
+ "or any other connection with the same client identifier, "
108+
+ "will not be added to the durable subscription.",
109+
mandatory = false,
110+
defaultValue = "false",
111+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
112+
type = "boolean")
113+
@ConnectorAttribute(name = JmsConnector.NAMED_FACTORY_ATTRIBUTE,
114+
description = "Select in case factory is injected as a named bean or configured with name.",
115+
mandatory = false,
116+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
117+
type = "string")
118+
@ConnectorAttribute(name = JmsConnector.POLL_TIMEOUT_ATTRIBUTE,
119+
description = "Timeout for polling for next message in every poll cycle in millis. Default value: 50",
120+
mandatory = false,
121+
defaultValue = "50",
122+
direction = ConnectorAttribute.Direction.INCOMING,
123+
type = "long")
124+
@ConnectorAttribute(name = JmsConnector.PERIOD_EXECUTIONS_ATTRIBUTE,
125+
description = "Period for executing poll cycles in millis.",
126+
mandatory = false,
127+
defaultValue = "100",
128+
direction = ConnectorAttribute.Direction.INCOMING,
129+
type = "long")
130+
@ConnectorAttribute(name = JmsConnector.SESSION_GROUP_ID_ATTRIBUTE,
131+
description = "When multiple channels share same session-group-id, "
132+
+ "they share same JMS session and same JDBC connection as well.",
133+
mandatory = false,
134+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
135+
type = "string")
35136
public interface AqConnector extends ConnectorFactory {
36137

37138
/**

messaging/connectors/jms/src/main/java/io/helidon/messaging/connectors/jms/JmsConnector.java

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
defaultValue = "false",
111111
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
112112
type = "boolean")
113+
@ConnectorAttribute(name = JmsConnector.AWAIT_ACK_ATTRIBUTE,
114+
description = "Wait for the acknowledgement of previous message before pulling next one.",
115+
mandatory = false,
116+
defaultValue = "false",
117+
direction = ConnectorAttribute.Direction.INCOMING_AND_OUTGOING,
118+
type = "boolean")
113119
@ConnectorAttribute(name = JmsConnector.MESSAGE_SELECTOR_ATTRIBUTE,
114120
description = "JMS API message selector expression based on a subset of the SQL92. "
115121
+ "Expression can only access headers and properties, not the payload.",
@@ -186,43 +192,93 @@ public class JmsConnector implements IncomingConnectorFactory, OutgoingConnector
186192
/**
187193
* Select in case factory is injected as a named bean or configured with name.
188194
*/
189-
protected static final String NAMED_FACTORY_ATTRIBUTE = "named-factory";
195+
public static final String NAMED_FACTORY_ATTRIBUTE = "named-factory";
196+
190197
/**
191-
* User name used with ConnectionFactory.
198+
* Username used with ConnectionFactory.
192199
*/
193-
protected static final String USERNAME_ATTRIBUTE = "username";
200+
public static final String USERNAME_ATTRIBUTE = "username";
201+
194202
/**
195203
* Password used with ConnectionFactory.
196204
*/
197-
protected static final String PASSWORD_ATTRIBUTE = "password";
205+
public static final String PASSWORD_ATTRIBUTE = "password";
206+
198207
/**
199208
* Client identifier for JMS connection.
200209
*/
201-
protected static final String CLIENT_ID_ATTRIBUTE = "client-id";
210+
public static final String CLIENT_ID_ATTRIBUTE = "client-id";
211+
202212
/**
203213
* True for creating durable consumer (only for topic).
204214
*/
205-
protected static final String DURABLE_ATTRIBUTE = "durable";
215+
public static final String DURABLE_ATTRIBUTE = "durable";
216+
206217
/**
207218
* Subscriber name for durable consumer used to identify subscription.
208219
*/
209-
protected static final String SUBSCRIBER_NAME_ATTRIBUTE = "subscriber-name";
220+
public static final String SUBSCRIBER_NAME_ATTRIBUTE = "subscriber-name";
221+
210222
/**
211223
* If true then any messages published to the topic using this session's connection,
212224
* or any other connection with the same client identifier,
213225
* will not be added to the durable subscription.
214226
*/
215-
protected static final String NON_LOCAL_ATTRIBUTE = "non-local";
216-
217-
static final String ACK_MODE_ATTRIBUTE = "acknowledge-mode";
218-
static final String TRANSACTED_ATTRIBUTE = "transacted";
219-
static final String AWAIT_ACK_ATTRIBUTE = "await-ack";
220-
static final String MESSAGE_SELECTOR_ATTRIBUTE = "message-selector";
221-
static final String POLL_TIMEOUT_ATTRIBUTE = "poll-timeout";
222-
static final String PERIOD_EXECUTIONS_ATTRIBUTE = "period-executions";
223-
static final String TYPE_ATTRIBUTE = "type";
224-
static final String DESTINATION_ATTRIBUTE = "destination";
225-
static final String SESSION_GROUP_ID_ATTRIBUTE = "session-group-id";
227+
public static final String NON_LOCAL_ATTRIBUTE = "non-local";
228+
229+
/**
230+
* JMS acknowledge mode.
231+
* <p>
232+
* Possible values are:
233+
* </p>
234+
* <ul>
235+
* <li>AUTO_ACKNOWLEDGE - session automatically acknowledges a client’s receipt of a message,
236+
* <li>CLIENT_ACKNOWLEDGE - receipt of a message is acknowledged only when Message.ack() is called manually,
237+
* <li>DUPS_OK_ACKNOWLEDGE - session lazily acknowledges the delivery of messages.
238+
* </ul>
239+
*/
240+
public static final String ACK_MODE_ATTRIBUTE = "acknowledge-mode";
241+
242+
/**
243+
* Indicates whether the session will use a local transaction.
244+
*/
245+
public static final String TRANSACTED_ATTRIBUTE = "transacted";
246+
247+
/**
248+
* Wait for the acknowledgement of previous message before pulling next one.
249+
*/
250+
public static final String AWAIT_ACK_ATTRIBUTE = "await-ack";
251+
252+
/**
253+
* JMS API message selector expression based on a subset of the SQL92.
254+
* Expression can only access headers and properties, not the payload.
255+
*/
256+
public static final String MESSAGE_SELECTOR_ATTRIBUTE = "message-selector";
257+
258+
/**
259+
* Timeout for polling for next message in every poll cycle in millis.
260+
*/
261+
public static final String POLL_TIMEOUT_ATTRIBUTE = "poll-timeout";
262+
263+
/**
264+
* Period for executing poll cycles in millis.
265+
*/
266+
public static final String PERIOD_EXECUTIONS_ATTRIBUTE = "period-executions";
267+
268+
/**
269+
* Possible values are: queue, topic.
270+
*/
271+
public static final String TYPE_ATTRIBUTE = "type";
272+
273+
/**
274+
* Queue or topic name.
275+
*/
276+
public static final String DESTINATION_ATTRIBUTE = "destination";
277+
278+
/**
279+
* When multiple channels share same session-group-id, they share same JMS session and same JDBC connection as well.
280+
*/
281+
public static final String SESSION_GROUP_ID_ATTRIBUTE = "session-group-id";
226282
static final String JNDI_ATTRIBUTE = "jndi";
227283
static final String JNDI_PROPS_ATTRIBUTE = "env-properties";
228284
static final String JNDI_JMS_FACTORY_ATTRIBUTE = "jms-factory";

0 commit comments

Comments
 (0)