Migration from Apache Pekko Connectors 1.x to 2.x
Apache Pekko Connectors 2.x requires Apache Pekko 2.x and Apache Pekko HTTP 2.x. The connectors that use gRPC require Apache Pekko gRPC 2.x. See the Pekko 1.x to 2.x migration guide, the Pekko HTTP 1.x to 2.x migration guide and the Pekko gRPC 1.x to 2.x migration guide for the changes in those libraries.
See the 2.0 release notes for the full list of changes.
General changes
- Java 17 is the minimum Java version. The File connector’s
DirectoryChangesSourceworks best with Java 17.0.4 or later, see File. - Scala 2.12 is no longer supported. The connectors are built for Scala 2.13 and Scala 3.
- Deprecated code has been removed, see Removed deprecated APIs. Before upgrading, build against the latest Pekko Connectors 1.x release and fix any deprecation warnings.
- Pekko Connectors 2.x needs to be used with Pekko 2.x, which is not binary compatible with Pekko 1.x. Recompile your code against the 2.x libraries. Libraries that depend on Pekko Connectors 1.x need to be rebuilt and released for Pekko Connectors 2.x.
- All Pekko Connectors modules that you use should be upgraded together, because they share the Pekko dependencies.
Removed connectors
- The IronMQ connector (
pekko-connectors-ironmq) has been removed (PR1898). It could no longer be tested, because the Docker images that its tests need are no longer available. The 1.x artifacts remain on Maven Central but they only work with Pekko 1.x.
Dependency changes
Java 17 as the minimum Java version made it possible to upgrade dependencies that no longer support Java 8 or 11. Some of these are new major versions, with their own breaking changes:
| Connector | Dependency | 1.x | 2.x |
|---|---|---|---|
| Apache Geode | Apache Geode | 1.15.x | 2.0.x |
| Apache Solr | SolrJ | 8.11.x | 9.x |
| Google Cloud BigQuery Storage | Apache Arrow | 17.x | 20.x |
| Google Cloud Pub/Sub gRPC, Google Cloud BigQuery Storage | protobuf-java | 3.25.x | 4.x |
| HBase | HBase client | 1.4.x | 2.6.x |
| HBase | Apache Hadoop | 2.7.x | 3.4.x |
| HDFS | Apache Hadoop | 3.3.x | 3.4.x |
| Slick | Slick | 3.5.x | 3.6.x |
| Spring Web | Spring Framework | 5.3.x | 7.x |
| Spring Web | Spring Boot | 2.7.x | 4.x |
- Java classes generated by protoc 3.x may not work with the protobuf-java 4.x runtime. Regenerate your own protobuf code and check any third-party libraries that ship generated protobuf classes.
- The Solr connector uses SolrJ 9 (PR1813). Code that creates the
SolrClientpassed to the connector needs to follow the SolrJ 9 API. - The Spring Web connector needs Spring Framework 7 and Spring Boot 4, which use the
jakartanamespaces.
Removed deprecated APIs
These APIs were deprecated in Alpakka, before the first Pekko Connectors release.
| Connector | Removed | Use instead |
|---|---|---|
| AWS DynamoDB | javadsl DynamoDb.single taking a Materializer |
the overload taking an actor system |
| AWS S3 | S3.download (scaladsl and javadsl) |
S3.getObject |
| Elasticsearch | ElasticsearchConnectionSettings.withConnectionContext |
withSSLContext |
| FTP | javadsl mkdirAsync taking a Materializer |
the overload taking an actor system |
| Google Cloud Pub/Sub | PubSubConfig.apply and create taking a project id, client email and private key, and PubSubConfig.projectId |
GoogleSettings, see Google Common |
| Google Cloud Pub/Sub gRPC | PubSubSettings.callCredentials and withCallCredentials |
GoogleSettings, see Google Common |
| Google Cloud Storage | GCStorageSettings, GCStorageExt, GCStorageAttributes, GCStorageSettingsPath, GCStorageSettingsValue and StorageSettings |
GoogleSettings and GoogleAttributes |
| Google Cloud Storage | javadsl getBucket, createBucket and deleteBucket taking a Materializer |
the overloads taking an actor system |
| Google FCM | The legacy API in org.apache.pekko.stream.connectors.google.firebase.fcm (GoogleFcm, FcmNotification, FcmNotificationModels, FcmResponse, ForwardProxy and the related classes) and the deprecated members of FcmSettings |
The equivalent classes in org.apache.pekko.stream.connectors.google.firebase.fcm.v1, and GoogleSettings for the credentials and the forward proxy |
| JMS, Jakarta Messaging | NullMessageProperty and NullMapMessageEntry |
These were unused |
| Pravega | TableReaderSettingsBuilder.withTableKey |
withKeyExtractor |
| Server-sent Events | javadsl EventSource.create taking a Materializer |
the overload taking an actor system |
| Spring Web | PekkoStreamsRegistrar(Materializer) |
the constructor taking an actor system |
Removed in PR1164, PR1187, PR1730, PR1731 and PR1748.
API changes
A number of Java DSL methods exposed Scala types, such as scala.concurrent.Future, scala.Function1 and scala.Option. Many of them have been replaced, or have a new alternative and are now deprecated. The changes that are not source compatible are listed here. The other Java API additions are listed in the release notes.
AMQP
- The Java API takes and returns the host and port pairs as
Pair<String, Integer>. Java code previously saw them asPair<String, Object>(PR2050). This applies toAmqpDetailsConnectionProvider.createand towithHostsAndPortsofAmqpDetailsConnectionProviderandAmqpConnectionFactoryConnectionProvider. A list that is declared asList<Pair<String, Object>>needs the new type. This is binary compatible.
Apache Cassandra
- The javadsl
CassandraFlow.createandwithContexttake aorg.apache.pekko.japi.function.Function2statement binder instead of the deprecatedorg.apache.pekko.japi.Function2(PR1132). Java lambdas compile unchanged. - The javadsl
CassandraFlow.createUnloggedBatchtakesorg.apache.pekko.japi.function.Function2andorg.apache.pekko.japi.function.Functionparameters instead of Scala functions (PR1527). The previous method is available as the deprecatedcreateUnloggedBatchWithScalaStatementBinder.
Couchbase
- The javadsl
CouchbaseSession.counterreturns aCompletionStage<java.lang.Long>andcreateIndexreturns aCompletionStage<java.lang.Boolean>. Java code previously saw both asCompletionStage<Object>(PR2052). Code that assigns the result to the previous type needs the new type. This is binary compatible.
Couchbase3
The Java DSL of the couchbase3 connector has been reworked (PR1526, PR1528, PR2052):
- The
CouchbaseSinkfactory methods materialize aCompletionStageinstead of ascala.concurrent.Future. The previous methods are available with aFuturesuffix (insertDocFuture,upsertFuture, …) and are deprecated. CouchbaseFlowandCouchbaseSinktake ajava.util.function.Functionto extract the document id instead of ascala.Function1.CouchbaseFlow.existsemitsjava.lang.Boolean.CouchbaseFlowandCouchbaseSourcetake the options and the collection or scope as explicit parameters of a single parameter list, instead of Scala default arguments and implicit parameters. There are overloads without the options.
CSV
- The javadsl
CsvFormatting.formatoverload with parameters takes an additionalboolean mitigateFormulaInjectionas its last parameter (PR1820). There is no overload without it, so Java callers need to add the argument. Passfalseto keep the previous behaviour.format()without arguments is unchanged. In the scaladsl, the parameter has a default value offalse.
Slick
- The javadsl
Slick.flowWithPassThroughoverloads that take ascala.concurrent.ExecutionContextare deprecated in favour of overloads that take ajava.util.concurrent.Executor(PR1527, PR1535).
Google Cloud Pub/Sub
- The javadsl
GooglePubSub.subscribeFlowmaterializes aCompletionStage<NotUsed>instead of ascala.concurrent.Future(PR1526). The previous method is available as the deprecatedsubscribeFlowFuture.
Google Cloud BigQuery
- The Java accessor
InsertAllRetryPolicy.withoutDeduplicationreturned the policy with deduplication by mistake. It now returns the policy without deduplication (PR2044). QueryRequest.getMaximumBytesBilledreturns anOptional<java.lang.Long>instead of anOptional<Object>(ajava.util.Optional[Long]in Scala). Code that assigns the result to the previous type needs the new type. This is binary compatible (PR2061).JobConfiguration.getLabelsandQueryRequest.getLabelsare deprecated, because the optional value is a ScalaMap. UsegetLabelsAsJava, which returns ajava.util.Map(PR2061).
Google Cloud BigQuery Storage
- The javadsl
BigQueryStorage.create, and thereadandreadMergedmethods ofBigQueryArrowStorageandBigQueryAvroStorage, that emit ascala.Tuple2are deprecated. UsecreateAsPair,readAsPairandreadMergedAsPair, which emit anorg.apache.pekko.japi.Pair(PR2061).
Google Common
RequestSettings.getForwardProxyis deprecated, because it returns ascala.Option. UseRequestSettings.getForwardProxyOptional, which returns ajava.util.Optional(PR2061). FromGoogleSettings, that isgetRequestSettings().getForwardProxyOptional().- Java code that called the request methods through
Google$.MODULE$can call them statically on the newGoogleApiobject, such asGoogleApi.singleRequest(...)(PR2061).
Google Cloud Storage
StorageObject.getTemporaryHoldandgetEventBasedHoldreturn anOptional<java.lang.Boolean>instead of anOptional<Object>(ajava.util.Optional[Boolean]in Scala). Code that assigns the result to the previous type needs the new type. This is binary compatible (PR2061).StorageObject.createis deprecated, because its optional values are Scala types. UsecreateFromJava, which takesjava.lang.Boolean,java.lang.Integer,java.util.Mapandjava.util.List(PR2061).
AWS Kinesis
- The javadsl
KinesisSchedulerSource.createShardedmaterializes aCompletionStage<Scheduler>instead of ascala.concurrent.Future(PR1526). The previous method is available as the deprecatedcreateShardedFuture.
Elasticsearch
- The Java getter
ReadResult.getVersionreturnsOptional<Long>. Java code previously saw it asOptional<Object>(PR2055).
MQTT Streaming
- The QoS constants of
ControlPacketFlags(QoSAtMostOnceDelivery,QoSAtLeastOnceDelivery,QoSExactlyOnceDelivery,QoSReservedandQoSFailure) andControlPacketFlags.ReservedUnsubAckhave been removed (PR1594). The QoS bits are encoded differently in a PUBLISH header and in a SUBSCRIBE payload, and the shared constants were wrong when subscribing. UsePublishQoSFlagsforPublishandSubscribeQoSFlagsforSubscribe.
OrientDB
OrientDbSourceSettingsandOrientDbWriteSettingstake acom.orientechnologies.orient.core.db.ODatabasePoolinstead of the deprecatedOPartitionedDatabasePool(PR1553).
Binary incompatible changes
These changes are source compatible, so recompiling is enough:
- CSV: the scaladsl
CsvFormatting.formathas an additionalmitigateFormulaInjectionparameter with a default value (PR1820). The javadsl change is not source compatible, see CSV. - Google Common and Huawei Push Kit:
ForwardProxy.applyhas an additionalminTlsVersionparameter (PR1808). - Google Common and Google Cloud BigQuery: the implicit parameters of
singleRequestare ordered differently in the bytecode (PR1682).
Behavior changes
AMQP
AmqpCachedConnectionProviderreplaces a cached connection that the broker has closed, unless the connection is recovering automatically (PR2063). Concurrent callers share one connection attempt, so one failure fails all of them.- Releasing an automatically recovering connection that is not open aborts it. This applies to all connection providers. A connection that is recovering when its stage stops no longer reconnects.
AmqpFlow.withConfirmandAmqpFlowWithContext.withConfirmreport each message’s own confirmation result (PR2018). Previously, a message could be reported with the result of another message.- The
toStringof the connection providers masks the password (PR1809).
AWS SPI Pekko HTTP
- A client built without explicit
ConnectionPoolSettingsor a custom settings builder applies the HTTP options of the AWS SDK (CONNECTION_TIMEOUT,CONNECTION_MAX_IDLE_TIMEOUT,MAX_CONNECTIONSandCONNECTION_TIME_TO_LIVE) on top of the Pekko HTTP configuration (PR1909). For example, the SDK defaults of 50 connections and a 2 second connect timeout replace the Pekko HTTP defaults ofmax-connections = 4andconnecting-timeout = 10s. Pass explicitConnectionPoolSettingsto keep control of these values. - Request bodies of GET and DELETE requests are sent instead of being dropped (PR1907).
- Request headers with more than one value are sent as one header per value, instead of failing with an
IllegalArgumentException(PR1906). - A negative
Content-Lengthis rejected with anIllegalArgumentException(PR1908, PR2118). close()logs a failure to shut down instead of throwing, and the actor systems that the client creates are namedaws-pekko-http-1,aws-pekko-http-2and so on, instead of all being namedaws-pekko-http(PR1904).
Apache Kudu
- The default
pekko.connectors.kudu.encryptionPolicyisREQUIRED_REMOTEinstead ofOPTIONAL(PR1818). Connections to remote servers that do not support encryption fail. Connections tolocalhostmay still be unencrypted.
Elasticsearch and Opensearch
- A request with credentials is rejected when the base URL does not use
https(PR1810, PR1871). For local development and testing,ElasticsearchConnectionSettings.withAllowInsecureCredentialsTransport(true)logs a warning instead. - A connection context set with
withSSLContextis also used when credentials are set. It was ignored in that case.
File
DirectoryChangesSourceno longer passes the JDK internalSensitivityWatchEventModifier.HIGHwhen it registers the directory to watch (PR1882). Java 17.0.4 is the minimum Java version that keeps the previous behaviour on platforms where the JDK polls the directory (macOS, for example). With Java 17.0.0 to 17.0.3, changes can take up to 10 seconds to be emitted instead of up to 2 seconds.TarArchiveMetadataandZipArchiveMetadatareject names that are absolute paths, or that contain..segments or backslashes, with anIllegalArgumentException(PR1807).- A zip archive that cannot be opened fails the stream of
Archive.zipReaderinstead of throwing an exception when the stream is materialized (PR1929). A missing archive is reported as aNoSuchFileExceptioninstead of aFileNotFoundException.
FTP
- The paths passed to the FTP and SFTP operations (retrieve, store, move, remove and make directory) are validated. Paths that contain
..segments are rejected with anIllegalArgumentException(PR1807).
Google connectors
OAuth2Credentialscan be closed (PR1927). Requests made afterclose()fail with anIllegalStateException.- The project id is resolved from the new
pekko.connectors.google.project-idsetting, then from the credentials provider, then from the newdefault-project-idsetting, which reads theGOOGLE_CLOUD_PROJECT,GCLOUD_PROJECTandGCP_PROJECTenvironment variables (PR1926). An existing configuration resolves the same project id as before, unless the credentials provider does not supply one and one of these environment variables is set. - The forward proxy creates its
SSLContextwith theTLSprotocol instead ofSSL(PR1808). This also applies to Huawei Push Kit. - The
toStringof the credentials and access token classes masks secrets (PR1809). - Google Cloud Pub/Sub gRPC:
PubSubSettingsno longer resolves credentials. They always come fromGoogleSettings(PR1494, PR1748). When you use the Pub/Sub emulator, setpekko.connectors.google.credentials.provider = none. - Google FCM:
LightSettings.light_off_duration(value)sets the light-off duration. It set the light-on duration by mistake (PR2045).
Huawei Push Kit
- The access token is refreshed according to the
expires_invalue of the token response, instead of a fixed hour (PR1812). - The
toStringofHmsSettingsmasks secrets (PR1809).
JMS and Jakarta Messaging
- The
toStringofCredentialsmasks the password (PR1809).
MQTT Streaming
UNSUBACKpackets are decoded with the fixed header flags that the MQTT specification defines (PR1594).- The Java constructor of
Commandthat takes aCompletionStagecompletes it exceptionally when the session fails the command (PR2048). A stage that the session cannot complete, such asminimalCompletionStage(), is rejected with anIllegalArgumentException.
OrientDB
S3
- The
toStringof the S3 model classes masks secrets (PR1809).
XML
- Invalid XML fails the stream with the
XMLStreamException, without the parser stage also logging an error (PR2015).
Configuration changes in Pekko Connectors 2.x
Changed default values
pekko.connectors.kudu.encryptionPolicy = "REQUIRED_REMOTE"(was"OPTIONAL")pekko.connectors.s3.allowed-headers:UploadPartalso allowsContent-Typeandx-amz-trailer, andInitiateMultipartUploadalso allowsContent-LengthandContent-MD5(PR1544)
Removed configuration
pekko.connectors.google.cloud.pubsub.grpc.callCredentials: usepekko.connectors.google.credentials.providerpekko.connectors.google.cloud.storage(project-id,client-email,private-key,base-url,base-path,token-urlandtoken-scope): configure the project id and the credentials withpekko.connectors.google.project-idandpekko.connectors.google.credentials, and a proxy withpekko.connectors.google.forward-proxy. Non-default values ofbase-url,base-pathandtoken-urlwere already rejected in 1.x. A custom endpoint is configured withpekko.connectors.google.cloud-storage.endpoint-urlandpekko.connectors.google.cloud-storage.base-path, which also exist in 1.x.pekko.connectors.ironmq: the connector has been removed
New configuration
pekko.connectors.google.project-idandpekko.connectors.google.default-project-id: see Google Common (PR1926)pekko.connectors.google.credentials.provider = google-application-default, with itspekko.connectors.google.credentials.google-application-default.project-idsetting: resolves the credentials with Google’sgoogle-auth-library-java, which supports GKE Workload Identity (PR1494). The default provider is stillapplication-default.pekko.connectors.google.forward-proxy.min-tls-versionandpekko.connectors.huawei.pushkit.forward-proxy.min-tls-version: the minimum TLS version of the forward proxy connection,TLSv1.2by default. It is only applied whentrust-pemis also set. Withouttrust-pem, the default HTTPS context of Pekko HTTP is used unchanged (PR1808, PR1870)pekko.connectors.s3.signing.path-encoded-characters: the characters that are percent-encoded in the path when a request is signed, for S3-compatible services such as Huawei OBS and Tencent COS (PR1971)