Skip to content

Commit

Permalink
v1.0.1 (#3)
Browse files Browse the repository at this point in the history
* Initialize the proxy adapter options with username and password

* Fix credential settings on the DataProviderServer instance

* Add tests to verify credential configurations

* Add project-report plugin

* Update CHANGELOG

* Rename and disable LightstreamerConnectorConfgiTest.shouldToHtml() test method to LightstreamerConnectorConfgiTest.shouldProduceFormattedConfiguration()

* Update CHANGELOG

* Fix reference to the Docker image name in examples/docker-kafka-connect/README.md

* Prepare gradle.properties for version 1.0.1

* Remove unused properties from the gradle.properties file

* Update javadoc

* Add depedency to build task on javadoc task

* Update CHANGELOG

* Update README.md

* Fix broken links in README.md

* Prepare version 1.0.1

* Update CHANGELOG

* Prepare version 1.0.1
  • Loading branch information
gfinocchiaro authored Aug 23, 2024
1 parent b2e3d09 commit 9e6a548
Show file tree
Hide file tree
Showing 20 changed files with 75 additions and 25 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [1.0.1] (2024-08-23)

**Improvements**

- Added the [Project Report Plugin](https://docs.gradle.org/current/userguide/project_report_plugin.html) to the [project](./kafka-connector-project/buildSrc/src/main/groovy/lightstreamer-kafka-connector.gradle#L5) to generate reports contaning information about the build.

- Added dependency on _javadoc_ task to the _build_ task in the [build.gradle](./kafka-connector-project/kafka-connector/build.gradle) file.

**Bug Fixes**

- The following configuration parameters for the Sink Connector:
- `lightstreamer.server.proxy_adapter.username`
- `lightstreamer.server.proxy_adapter.password`

were being ignored.

- The [com.lightstreamer.kafka.connect.config.LightstreamerConnectorConfigTest](./kafka-connector-project/kafka-connector/src/test/java/com/lightstreamer/kafka/connect/config/LightstreamerConnectorConfigTest.java) class contained a test producing unwanted output files.

- The [examples/docker-kafka-connect/README.md](./examples/docker-kafka-connect/README.md) file contained a wrong reference to the Docker image name.

- The [gradle.properties](./kafka-connector-project/gradle.properties) file contained an unsed property.

- The [README.md](README.md) contained broken links.

## [1.0.0] (2024-08-20)

- First official public release
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ To quickly complete the installation and verify the successful integration with

Since a generic Ligthstreamer client needs to subscribe to one or more items to receive real-time updates, Kafka Connector has to offer proper mechanisms to realize the mapping between Kafka topics and Lightstreamer items.

The `QuickStart` [factory configuration](kafka-connector-project/dist/adapters.xml#L39) comes with a simple mapping through the following settings:
The `QuickStart` [factory configuration](kafka-connector-project/kafka-connector/src/adapter/dist/adapters.xml#L39) comes with a simple mapping through the following settings:

- An item template:
```xml
Expand Down Expand Up @@ -897,13 +897,13 @@ Example:

Kafka Connector allows the configuration of several routing and mapping strategies, thus enabling the convey of Kafka events streams to a potentially huge amount of devices connected to Lightstreamer with great flexibility.

As anticipated in the [_Installation_](#configure) section, a Kafka record can be analyzed in all its aspects to extract information that can be:
- Routed to the designated Lightstreamer items
- Remapped to specific Lightstreamer fields
Furthermore, as anticipated in the [_Installation_](#configure) section, a Kafka record can be analyzed in all its aspects to extract data that can be used for:
- Mapping to specific Lightstreamer fields
- Filtered routing to the designated Lightstreamer items

##### Record Routing (`map.<topic>.to`)

To configure the routing of Kafka event streams to Lightstreamer items, use at least one `map.<topic>.to` parameter. The general format is:
To configure a simple routing of Kafka event streams to Lightstreamer items, use at least one `map.<topic>.to` parameter. The general format is:

```xml
<param name="map.<topic-name>.to">item1,item2,itemN,...</param>
Expand Down Expand Up @@ -1021,7 +1021,7 @@ To write an extraction expression, Kafka Connector provides the _Data Extraction

In case of non-scalar value, an error will be thrown during the extraction process and handled as per the [configured strategy](#recordextractionerrorstrategy).

The `QuickStart` [factory configuration](kafka-connector-project/kafka-connector/src/connector/dist/adapters.xml#L353) shows a basic example, where a simple _direct_ mapping has been defined between every attribute of the JSON record value and a Lightstreamer field with the same name. Of course, thanks to the _Data Extraction Language_, more complex mapping can be employed.
The `QuickStart` [factory configuration](kafka-connector-project/kafka-connector/src/adapter/dist/adapters.xml#L352) shows a basic example, where a simple _direct_ mapping has been defined between every attribute of the JSON record value and a Lightstreamer field with the same name. Of course, thanks to the _Data Extraction Language_, more complex mapping can be employed.

```xml
...
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/allclasses-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>All Classes and Interfaces (kafka-connector 1.0.0 API)</title>
<title>All Classes and Interfaces (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="class index">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/allpackages-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>All Packages (kafka-connector 1.0.0 API)</title>
<title>All Packages (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="package index">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>KafkaConnectorMetadataAdapter (kafka-connector 1.0.0 API)</title>
<title>KafkaConnectorMetadataAdapter (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="declaration: package: com.lightstreamer.kafka.adapters.pub, class: KafkaConnectorMetadataAdapter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>com.lightstreamer.kafka.adapters.pub (kafka-connector 1.0.0 API)</title>
<title>com.lightstreamer.kafka.adapters.pub (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="declaration: package: com.lightstreamer.kafka.adapters.pub">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>com.lightstreamer.kafka.adapters.pub Class Hierarchy (kafka-connector 1.0.0 API)</title>
<title>com.lightstreamer.kafka.adapters.pub Class Hierarchy (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="tree: package: com.lightstreamer.kafka.adapters.pub">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/help-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>API Help (kafka-connector 1.0.0 API)</title>
<title>API Help (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="help">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Index (kafka-connector 1.0.0 API)</title>
<title>Index (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="index">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Overview (kafka-connector 1.0.0 API)</title>
<title>Overview (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="package index">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/overview-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>kafka-connector 1.0.0 API</title>
<title>kafka-connector 1.0.1 API</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="index redirect">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/overview-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Class Hierarchy (kafka-connector 1.0.0 API)</title>
<title>Class Hierarchy (kafka-connector 1.0.1 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="class tree">
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-kafka-connector-adapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
}

dependencies {
implementation group: 'com.lightstreamer.kafka', name: 'kafka-connector', 'version': '1.0.0'
implementation group: 'com.lightstreamer.kafka', name: 'kafka-connector', 'version': '1.0.1'
}

java {
Expand Down
4 changes: 2 additions & 2 deletions examples/docker-kafka-connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ The image is based on the official [Official Confluent Docker Base Image for Kaf
```sh
$ docker image ls kafka-connect-lightstreamer-<version>

REPOSITORY TAG IMAGE ID CREATED SIZE
kafka-connect-lightstreamer-1.0.0 latest 417d099deaa8 18 seconds ago 1.75GB
REPOSITORY TAG IMAGE ID CREATED SIZE
kafka-connect-lightstreamer-<version> latest 417d099deaa8 18 seconds ago 1.75GB
```

## Running in Docker Compose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java-library'
id 'maven-publish'
id 'com.diffplug.spotless'
id 'project-report'
}

group = 'com.lightstreamer.kafka'
Expand Down
5 changes: 2 additions & 3 deletions kafka-connector-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version=1.0.0
version=1.0.1
brandedProjectName=Lightstreamer Kafka Connector
release_date=2024-08-19
distDir=../dist
release_date=2024-08-23
connect_owner=lightstreamer
connect_componentName=kafka-connect-lightstreamer
2 changes: 2 additions & 0 deletions kafka-connector-project/kafka-connector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ distributions {
}
}
}

build.dependsOn javadoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.kafka.common.config.ConfigDef.Importance;
import org.apache.kafka.common.config.ConfigDef.Range;
import org.apache.kafka.common.config.ConfigDef.Type;
import org.apache.kafka.common.config.types.Password;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -261,13 +262,16 @@ public LightstreamerConnectorConfig(Map<?, ?> originals) {
fieldConfigs = initFieldConfigs();

Pair address = getProxyAdapterAddress();

proxyAdapterClientOptions =
new ProxyAdapterClientOptions.Builder()
.hostname(address.key())
.port(Integer.valueOf(address.value()))
.connectionTimeout(getSetupConnectionTimeoutMs())
.connectionMaxRetries(getSetupConnectionMaxRetries())
.connectionRetryDelayMs(getSetupConnectionRetryDelayMs())
.username(getUsername())
.password(getPassword())
.build();
}

Expand All @@ -287,6 +291,15 @@ public long getSetupConnectionRetryDelayMs() {
return getLong(LIGHTSTREAMER_PROXY_ADAPTER_CONNECTION_SETUP_RETRY_DELAY_MS);
}

public String getUsername() {
return getString(LIGHTSTREAMER_PROXY_ADAPTER_USERNAME);
}

public String getPassword() {
Password password = getPassword(LIGHTSTREAMER_PROXY_ADAPTER_PASSWORD);
return password != null ? password.value() : null;
}

public List<TopicMappingConfig> getTopicMappings() {
return topicMppingCofigs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void start(DataProvider provider) throws RemotingException {
dataProviderServer = new DataProviderServer();
dataProviderServer.setAdapter(provider);
if (options.username != null && options.password != null) {
dataProviderServer.setRemoteUser(options.password);
logger.info("Setting credentials");
dataProviderServer.setRemoteUser(options.username);
dataProviderServer.setRemotePassword(options.password);
}

Expand All @@ -66,7 +67,7 @@ public void start(DataProvider provider) throws RemotingException {
dataProviderServer.setReplyStream(socket.getOutputStream());
dataProviderServer.setRequestStream(socket.getInputStream());

logger.info("Connected to Lightstreame Proxy Aadapter");
logger.info("Connected to Lightstreamer Proxy Aadapter");
break;

} catch (IOException io) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.config.ConfigException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
Expand Down Expand Up @@ -183,6 +184,8 @@ void shouldGetProxyAdapterClientOptions() {
assertThat(proxyAdapterClientOptions.connectionTimeout).isEqualTo(5000);
assertThat(proxyAdapterClientOptions.connectionMaxRetries).isEqualTo(1);
assertThat(proxyAdapterClientOptions.connectionRetryDelayMs).isEqualTo(5000);
assertThat(proxyAdapterClientOptions.username).isNull();
assertThat(proxyAdapterClientOptions.password).isNull();

Map<String, String> updateConfigs = new HashMap<>(basicConfig());
updateConfigs.put(
Expand All @@ -199,6 +202,10 @@ void shouldGetProxyAdapterClientOptions() {
LightstreamerConnectorConfig
.LIGHTSTREAMER_PROXY_ADAPTER_CONNECTION_SETUP_RETRY_DELAY_MS,
"15000");
updateConfigs.put(
LightstreamerConnectorConfig.LIGHTSTREAMER_PROXY_ADAPTER_USERNAME, "user");
updateConfigs.put(
LightstreamerConnectorConfig.LIGHTSTREAMER_PROXY_ADAPTER_PASSWORD, "password");

config = new LightstreamerConnectorConfig(updateConfigs);

Expand All @@ -209,6 +216,8 @@ void shouldGetProxyAdapterClientOptions() {
assertThat(proxyAdapterClientOptions.connectionTimeout).isEqualTo(10000);
assertThat(proxyAdapterClientOptions.connectionMaxRetries).isEqualTo(5);
assertThat(proxyAdapterClientOptions.connectionRetryDelayMs).isEqualTo(15000);
assertThat(proxyAdapterClientOptions.username).isEqualTo("user");
assertThat(proxyAdapterClientOptions.password).isEqualTo("password");
}

@Test
Expand Down Expand Up @@ -361,7 +370,8 @@ public void shouldNotRetrieveRecordErrorHandlingStrategy(String noValidStrategy)
}

@Test
public void shouldToHtmml() throws IOException {
@Disabled
public void shouldProduceFormattedConfiguration() throws IOException {
ConfigDef config = LightstreamerConnectorConfig.makeConfig();
Files.write(config.toHtml().getBytes(), new File("config.html"));
Files.write(config.toEnrichedRst().getBytes(), new File("config_enriched.rst"));
Expand Down

0 comments on commit 9e6a548

Please sign in to comment.