-
Notifications
You must be signed in to change notification settings - Fork 4.5k
SolaceIO write connector #32060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SolaceIO write connector #32060
Changes from all commits
dba27f5
dc044b9
0bd77d0
5249d9e
4681a07
99d9993
048de8a
bbeaff4
3ab4d0b
cd01cff
f6d1f1e
ce1327b
af28bde
e5521ae
19ade8a
26c9d48
997fe56
251f14d
a7a5eff
29ed200
ff5f09a
33d1771
fe8b3ca
ad5c45b
6a8b9ce
44059c8
602e85b
f31a320
4dddd33
4f9c024
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |
| package org.apache.beam.sdk.io.solace.broker; | ||
|
|
||
| import static org.apache.beam.sdk.io.solace.broker.SessionService.DEFAULT_VPN_NAME; | ||
| import static org.apache.beam.sdk.util.Preconditions.checkStateNotNull; | ||
|
|
||
| import com.google.auto.value.AutoValue; | ||
|
|
||
|
|
@@ -31,12 +30,16 @@ | |
| */ | ||
| @AutoValue | ||
| public abstract class BasicAuthJcsmpSessionServiceFactory extends SessionServiceFactory { | ||
| /** The host name or IP address of the Solace broker. Format: Host[:Port] */ | ||
| public abstract String host(); | ||
|
|
||
| /** The username to use for authentication. */ | ||
| public abstract String username(); | ||
|
|
||
| /** The password to use for authentication. */ | ||
| public abstract String password(); | ||
|
|
||
| /** The name of the VPN to connect to. */ | ||
| public abstract String vpnName(); | ||
|
|
||
| public static Builder builder() { | ||
|
|
@@ -54,6 +57,7 @@ public abstract static class Builder { | |
|
|
||
| /** Set Solace username. */ | ||
| public abstract Builder username(String username); | ||
|
|
||
| /** Set Solace password. */ | ||
| public abstract Builder password(String password); | ||
|
|
||
|
|
@@ -65,11 +69,15 @@ public abstract static class Builder { | |
|
|
||
| @Override | ||
| public SessionService create() { | ||
| return new BasicAuthJcsmpSessionService( | ||
| checkStateNotNull(queue, "SolaceIO.Read: Queue is not set.").getName(), | ||
| host(), | ||
| username(), | ||
| password(), | ||
| vpnName()); | ||
| BasicAuthJcsmpSessionService.Builder builder = BasicAuthJcsmpSessionService.builder(); | ||
| if (queue != null) { | ||
| builder = builder.queueName(queue.getName()); | ||
| } | ||
|
Comment on lines
+73
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this change from throwing to checking?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class was initially used for the The Initially, there were different classes for |
||
| return builder | ||
| .host(host()) | ||
| .username(username()) | ||
| .password(password()) | ||
| .vpnName(vpnName()) | ||
| .build(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.beam.sdk.io.solace.broker; | ||
|
|
||
| import com.solacesystems.jcsmp.DeliveryMode; | ||
| import com.solacesystems.jcsmp.Destination; | ||
| import java.util.List; | ||
| import org.apache.beam.sdk.annotations.Internal; | ||
| import org.apache.beam.sdk.io.solace.data.Solace; | ||
| import org.apache.beam.sdk.transforms.SerializableFunction; | ||
|
|
||
| /** | ||
| * Base class for publishing messages to a Solace broker. | ||
| * | ||
| * <p>Implementations of this interface are responsible for managing the connection to the broker | ||
| * and for publishing messages to the broker. | ||
| */ | ||
| @Internal | ||
| public interface MessageProducer { | ||
|
|
||
| /** Publishes a message to the broker. */ | ||
| void publishSingleMessage( | ||
| Solace.Record msg, | ||
| Destination topicOrQueue, | ||
| boolean useCorrelationKeyLatency, | ||
| DeliveryMode deliveryMode); | ||
|
|
||
| /** | ||
| * Publishes a batch of messages to the broker. | ||
| * | ||
| * <p>The size of the batch cannot exceed 50 messages, this is a limitation of the Solace API. | ||
| * | ||
| * <p>It returns the number of messages written. | ||
| */ | ||
| int publishBatch( | ||
| List<Solace.Record> records, | ||
| boolean useCorrelationKeyLatency, | ||
| SerializableFunction<Solace.Record, Destination> destinationFn, | ||
| DeliveryMode deliveryMode); | ||
|
|
||
| /** Returns {@literal true} if the message producer is closed, {@literal false} otherwise. */ | ||
| boolean isClosed(); | ||
|
|
||
| /** Closes the message producer. */ | ||
| void close(); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.