Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions obp-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
<groupId>com.tesobe</groupId>
<artifactId>obp-commons</artifactId>
</dependency>
<!--embed akka adapter start-->
<!--embed akka adapter start - COMMENTED OUT FOR PEKKO MIGRATION-->
<!-- TODO: Find or create Pekko equivalent for adapter-akka-commons
<dependency>
<groupId>com.github.OpenBankProject.OBP-Adapter-Akka-SpringBoot</groupId>
<artifactId>adapter-akka-commons</artifactId>
Expand All @@ -95,6 +96,7 @@
</exclusion>
</exclusions>
</dependency>
-->
<!--embed akka adapter end-->
<dependency>
<groupId>com.github.everit-org.json-schema</groupId>
Expand Down Expand Up @@ -288,21 +290,21 @@
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.typesafe.akka/akka-http-core -->
<!-- https://mvnrepository.com/artifact/org.apache.pekko/pekko-http-core -->
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http-core_${scala.version}</artifactId>
<version>10.1.6</version>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-http-core_${scala.version}</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_${scala.version}</artifactId>
<version>${akka.version}</version>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-actor_${scala.version}</artifactId>
<version>${pekko.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-remote_${scala.version}</artifactId>
<version>${akka.version}</version>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-remote_${scala.version}</artifactId>
<version>${pekko.version}</version>
</dependency>
<dependency>
<groupId>com.sksamuel.avro4s</groupId>
Expand All @@ -316,8 +318,8 @@
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>chill-akka_${scala.version}</artifactId>
<version>0.9.1</version>
<artifactId>chill_${scala.version}</artifactId>
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
Expand All @@ -337,9 +339,9 @@
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-slf4j_${scala.version}</artifactId>
<version>${akka.version}</version>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-slf4j_${scala.version}</artifactId>
<version>${pekko.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.dwickern/scala-nameof_2.11 -->
<dependency>
Expand Down
52 changes: 26 additions & 26 deletions obp-api/src/main/scala/code/actorsystem/ObpActorConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ object ObpActorConfig {

val commonConf =
"""
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = """ + akka_loglevel + """
actor {
provider = "akka.remote.RemoteActorRefProvider"
allow-java-serialization = off
provider = "org.apache.pekko.remote.RemoteActorRefProvider"
allow-java-serialization = on
kryo {
type = "graph"
idstrategy = "default"
Expand All @@ -40,31 +40,31 @@ object ObpActorConfig {
resolve-subclasses = true
}
serializers {
kryo = "com.twitter.chill.akka.AkkaSerializer"
java = "org.apache.pekko.serialization.JavaSerializer"
}
serialization-bindings {
"net.liftweb.common.Full" = kryo,
"net.liftweb.common.Empty" = kryo,
"net.liftweb.common.Box" = kryo,
"net.liftweb.common.ParamFailure" = kryo,
"code.api.APIFailure" = kryo,
"com.openbankproject.commons.model.BankAccount" = kryo,
"com.openbankproject.commons.model.View" = kryo,
"com.openbankproject.commons.model.User" = kryo,
"com.openbankproject.commons.model.ViewId" = kryo,
"com.openbankproject.commons.model.BankIdAccountIdViewId" = kryo,
"com.openbankproject.commons.model.Permission" = kryo,
"scala.Unit" = kryo,
"scala.Boolean" = kryo,
"java.io.Serializable" = kryo,
"scala.collection.immutable.List" = kryo,
"akka.actor.ActorSelectionMessage" = kryo,
"code.model.Consumer" = kryo,
"code.model.AppType" = kryo
"net.liftweb.common.Full" = java,
"net.liftweb.common.Empty" = java,
"net.liftweb.common.Box" = java,
"net.liftweb.common.ParamFailure" = java,
"code.api.APIFailure" = java,
"com.openbankproject.commons.model.BankAccount" = java,
"com.openbankproject.commons.model.View" = java,
"com.openbankproject.commons.model.User" = java,
"com.openbankproject.commons.model.ViewId" = java,
"com.openbankproject.commons.model.BankIdAccountIdViewId" = java,
"com.openbankproject.commons.model.Permission" = java,
"scala.Unit" = java,
"scala.Boolean" = java,
"java.io.Serializable" = java,
"scala.collection.immutable.List" = java,
"org.apache.pekko.actor.ActorSelectionMessage" = java,
"code.model.Consumer" = java,
"code.model.AppType" = java
}
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
enabled-transports = ["org.apache.pekko.remote.netty.tcp"]
netty {
tcp {
send-buffer-size = 50000000
Expand All @@ -79,7 +79,7 @@ object ObpActorConfig {
val lookupConf =
s"""
${commonConf}
akka {
pekko {
remote.netty.tcp.hostname = ${localHostname}
remote.netty.tcp.port = 0
}
Expand All @@ -88,7 +88,7 @@ object ObpActorConfig {
val localConf =
s"""
${commonConf}
akka {
pekko {
remote.netty.tcp.hostname = ${localHostname}
remote.netty.tcp.port = ${localPort}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package code.actorsystem

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import code.bankconnectors.akka.actor.AkkaConnectorActorConfig
import code.util.Helper
import code.util.Helper.MdcLoggable
Expand Down
12 changes: 6 additions & 6 deletions obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package code.actorsystem

import akka.actor.{ActorSystem}
import org.apache.pekko.actor.{ActorSystem}
import code.api.util.APIUtil
import code.bankconnectors.LocalMappedOutInBoundTransfer
import code.bankconnectors.akka.actor.{AkkaConnectorActorConfig, AkkaConnectorHelperActor}
import code.util.Helper
import code.util.Helper.MdcLoggable
import com.openbankproject.adapter.akka.commons.config.AkkaConfig
// import com.openbankproject.adapter.pekko.commons.config.PekkoConfig // TODO: Re-enable when Pekko adapter is available
import com.typesafe.config.ConfigFactory
import net.liftweb.common.Full

Expand Down Expand Up @@ -38,7 +38,7 @@ trait ObpLookupSystem extends MdcLoggable {
if (port == 0) {
logger.error("Failed to connect to local Remotedata actor, the port is 0, can not find a proper port in current machine.")
}
s"akka.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}"
s"pekko.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}"
}

this.obpLookupSystem.actorSelection(actorPath)
Expand All @@ -55,7 +55,7 @@ trait ObpLookupSystem extends MdcLoggable {
val hostname = h
val port = p
val akka_connector_hostname = Helper.getAkkaConnectorHostname
s"akka.tcp://SouthSideAkkaConnector_${akka_connector_hostname}@${hostname}:${port}/user/${actorName}"
s"pekko.tcp://SouthSideAkkaConnector_${akka_connector_hostname}@${hostname}:${port}/user/${actorName}"

case _ =>
val hostname = AkkaConnectorActorConfig.localHostname
Expand All @@ -66,12 +66,12 @@ trait ObpLookupSystem extends MdcLoggable {
}

if(embeddedAdapter) {
AkkaConfig(LocalMappedOutInBoundTransfer, Some(ObpActorSystem.northSideAkkaConnectorActorSystem))
// AkkaConfig(LocalMappedOutInBoundTransfer, Some(ObpActorSystem.northSideAkkaConnectorActorSystem)) // TODO: Re-enable when Pekko adapter is available
} else {
AkkaConnectorHelperActor.startAkkaConnectorHelperActors(ObpActorSystem.northSideAkkaConnectorActorSystem)
}

s"akka.tcp://SouthSideAkkaConnector_${props_hostname}@${hostname}:${port}/user/${actorName}"
s"pekko.tcp://SouthSideAkkaConnector_${props_hostname}@${hostname}:${port}/user/${actorName}"
}
this.obpLookupSystem.actorSelection(actorPath)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package code.api.dynamic.endpoint.helper

import akka.http.scaladsl.model.{HttpMethods, HttpMethod => AkkaHttpMethod}
import org.apache.pekko.http.scaladsl.model.{HttpMethods, HttpMethod => PekkoHttpMethod}
import code.DynamicData.{DynamicDataProvider, DynamicDataT}
import code.DynamicEndpoint.{DynamicEndpointProvider, DynamicEndpointT}
import code.api.util.APIUtil.{BigDecimalBody, BigIntBody, BooleanBody, DoubleBody, EmptyBody, FloatBody, IntBody, JArrayBody, LongBody, PrimaryDataBody, ResourceDoc, StringBody}
Expand Down Expand Up @@ -171,15 +171,15 @@ object DynamicEndpointHelper extends RestHelper {
* @param r HttpRequest
* @return (adapterUrl, requestBodyJson, httpMethod, requestParams, pathParams, role, operationId, mockResponseCode->mockResponseBody)
*/
def unapply(r: Req): Option[(String, JValue, AkkaHttpMethod, Map[String, List[String]], Map[String, String], ApiRole, String, Option[(Int, JValue)], Option[String])] = {
def unapply(r: Req): Option[(String, JValue, PekkoHttpMethod, Map[String, List[String]], Map[String, String], ApiRole, String, Option[(Int, JValue)], Option[String])] = {

val requestUri = r.request.uri //eg: `/obp/dynamic-endpoint/fashion-brand-list/BRAND_ID`
val partPath = r.path.partPath //eg: List("fashion-brand-list","BRAND_ID"), the dynamic is from OBP URL, not in the partPath now.

if (!testResponse_?(r) || !requestUri.startsWith(s"/${ApiStandards.obp.toString}/${ApiShortVersions.`dynamic-endpoint`.toString}"+urlPrefix))//if check the Content-Type contains json or not, and check the if it is the `dynamic_endpoints_url_prefix`
None //if do not match `URL and Content-Type`, then can not find this endpoint. return None.
else {
val akkaHttpMethod = HttpMethods.getForKeyCaseInsensitive(r.requestType.method).get
val pekkoHttpMethod = HttpMethods.getForKeyCaseInsensitive(r.requestType.method).get
val httpMethod = HttpMethod.valueOf(r.requestType.method)
val urlQueryParameters = r.params
// url that match original swagger endpoint.
Expand Down Expand Up @@ -230,7 +230,7 @@ object DynamicEndpointHelper extends RestHelper {

val Some(role::_) = doc.roles
val requestBodyJValue = body(r).getOrElse(JNothing)
Full(s"""$serverUrl$url""", requestBodyJValue, akkaHttpMethod, urlQueryParameters, pathParams, role, doc.operationId, mockResponse, bankId)
Full(s"""$serverUrl$url""", requestBodyJValue, pekkoHttpMethod, urlQueryParameters, pathParams, role, doc.operationId, mockResponse, bankId)
}

}
Expand Down
8 changes: 4 additions & 4 deletions obp-api/src/main/scala/code/api/util/DynamicUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ object DynamicUtil extends MdcLoggable{
|import java.util.Date
|import java.util.UUID.randomUUID
|
|import _root_.akka.stream.StreamTcpException
|import akka.http.scaladsl.model.headers.RawHeader
|import akka.http.scaladsl.model.{HttpProtocol, _}
|import akka.util.ByteString
|import _root_.org.apache.pekko.stream.StreamTcpException
|import org.apache.pekko.http.scaladsl.model.headers.RawHeader
|import org.apache.pekko.http.scaladsl.model.{HttpProtocol, _}
|import org.apache.pekko.util.ByteString
|import code.api.APIFailureNewStyle
|import code.api.ResourceDocs1_4_0.MessageDocsSwaggerDefinitions
|import code.api.cache.Caching
Expand Down
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/code/api/util/NewStyle.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package code.api.util


import akka.http.scaladsl.model.HttpMethod
import org.apache.pekko.http.scaladsl.model.HttpMethod
import code.DynamicEndpoint.{DynamicEndpointProvider, DynamicEndpointT}
import code.api.Constant.{SYSTEM_READ_ACCOUNTS_BERLIN_GROUP_VIEW_ID, SYSTEM_READ_BALANCES_BERLIN_GROUP_VIEW_ID}
import code.api.builder.PaymentInitiationServicePISApi.APIMethods_PaymentInitiationServicePISApi.checkPaymentServerTypeError
Expand Down
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/code/bankconnectors/Connector.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package code.bankconnectors

import _root_.akka.http.scaladsl.model.HttpMethod
import org.apache.pekko.http.scaladsl.model.HttpMethod
import code.api.attributedefinition.AttributeDefinition
import code.api.util.APIUtil.{OBPReturnType, _}
import code.api.util.ErrorMessages._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package code.bankconnectors

import _root_.akka.http.scaladsl.model.HttpMethod
import _root_.org.apache.pekko.http.scaladsl.model.HttpMethod
import code.DynamicData.DynamicDataProvider
import code.accountapplication.AccountApplicationX
import code.accountattribute.AccountAttributeX
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package code.bankconnectors.akka

import java.util.Date
import akka.pattern.ask
import org.apache.pekko.pattern.ask
import code.actorsystem.ObpLookupSystem
import code.api.ResourceDocs1_4_0.MessageDocsSwaggerDefinitions
import code.api.ResourceDocs1_4_0.MessageDocsSwaggerDefinitions.{bankAccountCommons, bankCommons, transaction, _}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ object AkkaConnectorActorConfig {

val commonConf =
"""
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = """ + akka_loglevel + """
actor {
provider = "akka.remote.RemoteActorRefProvider"
allow-java-serialization = off
provider = "org.apache.pekko.remote.RemoteActorRefProvider"
allow-java-serialization = on
kryo {
type = "graph"
idstrategy = "default"
Expand All @@ -43,31 +43,31 @@ object AkkaConnectorActorConfig {
resolve-subclasses = true
}
serializers {
kryo = "com.twitter.chill.akka.AkkaSerializer"
java = "org.apache.pekko.serialization.JavaSerializer"
}
serialization-bindings {
"net.liftweb.common.Full" = kryo,
"net.liftweb.common.Empty" = kryo,
"net.liftweb.common.Box" = kryo,
"net.liftweb.common.ParamFailure" = kryo,
"code.api.APIFailure" = kryo,
"com.openbankproject.commons.model.BankAccount" = kryo,
"com.openbankproject.commons.model.View" = kryo,
"com.openbankproject.commons.model.User" = kryo,
"com.openbankproject.commons.model.ViewId" = kryo,
"com.openbankproject.commons.model.BankIdAccountIdViewId" = kryo,
"com.openbankproject.commons.model.Permission" = kryo,
"scala.Unit" = kryo,
"scala.Boolean" = kryo,
"java.io.Serializable" = kryo,
"scala.collection.immutable.List" = kryo,
"akka.actor.ActorSelectionMessage" = kryo,
"code.model.Consumer" = kryo,
"code.model.AppType" = kryo
"net.liftweb.common.Full" = java,
"net.liftweb.common.Empty" = java,
"net.liftweb.common.Box" = java,
"net.liftweb.common.ParamFailure" = java,
"code.api.APIFailure" = java,
"com.openbankproject.commons.model.BankAccount" = java,
"com.openbankproject.commons.model.View" = java,
"com.openbankproject.commons.model.User" = java,
"com.openbankproject.commons.model.ViewId" = java,
"com.openbankproject.commons.model.BankIdAccountIdViewId" = java,
"com.openbankproject.commons.model.Permission" = java,
"scala.Unit" = java,
"scala.Boolean" = java,
"java.io.Serializable" = java,
"scala.collection.immutable.List" = java,
"org.apache.pekko.actor.ActorSelectionMessage" = java,
"code.model.Consumer" = java,
"code.model.AppType" = java
}
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
enabled-transports = ["org.apache.pekko.remote.netty.tcp"]
netty {
tcp {
send-buffer-size = 50000000
Expand All @@ -82,7 +82,7 @@ object AkkaConnectorActorConfig {
val lookupConf =
s"""
${commonConf}
akka {
pekko {
remote.netty.tcp.hostname = ${localHostname}
remote.netty.tcp.port = 0
}
Expand All @@ -91,7 +91,7 @@ object AkkaConnectorActorConfig {
val localConf =
s"""
${commonConf}
akka {
pekko {
remote.netty.tcp.hostname = ${localHostname}
remote.netty.tcp.port = ${localPort}
}
Expand All @@ -100,7 +100,7 @@ object AkkaConnectorActorConfig {
val remoteConf =
s"""
${commonConf}
akka {
pekko {
remote.netty.tcp.hostname = ${remoteHostname}
remote.netty.tcp.port = ${remotePort}
}
Expand Down
Loading
Loading