diff --git a/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala b/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala deleted file mode 100644 index 5e40fde3e..000000000 --- a/obp-api/src/main/scala/code/actorsystem/ObpActorInit.scala +++ /dev/null @@ -1,53 +0,0 @@ -package code.actorsystem - -import akka.util.Timeout -import code.api.APIFailure -import code.api.util.APIUtil -import code.util.Helper.MdcLoggable -import net.liftweb.common._ - -import com.openbankproject.commons.ExecutionContext.Implicits.global -import scala.concurrent.duration._ -import scala.concurrent.{Await, Future} -import scala.reflect.ClassTag - -trait ObpActorInit extends MdcLoggable{ - // Default is 3 seconds, which should be more than enough for slower systems - val ACTOR_TIMEOUT: Long = APIUtil.getPropsAsLongValue("remotedata.timeout").openOr(3) - - val actorName = CreateActorNameFromClassName(this.getClass.getName) - val actor = ObpLookupSystem.getActor(actorName) - logger.debug(s"Create this Actor: $actorName: ${actor}") - val TIMEOUT = (ACTOR_TIMEOUT seconds) - implicit val timeout = Timeout(ACTOR_TIMEOUT * (1000 milliseconds)) - - /** - * This function extracts the payload from Future and wraps it to Box. - * It is used for Old Style Endpoints at Kafka connector. - * @param f The payload wrapped into Future - * @tparam T The type of the payload - * @return The payload wrapped into Box - */ - def extractFutureToBox[T: ClassTag](f: Future[Any]): Box[T] = { - val r: Future[Box[T]] = f.map { - case f@ (_: ParamFailure[_] | _: APIFailure) => Empty ~> f - case f: Failure => f - case Empty => Empty - case t: T => Full(t) - case _ => Empty ~> APIFailure("future extraction to box failed", 501) - } - - Await.result(r, TIMEOUT) - - } - - def getValueFromFuture[T](f: Future[T]): T = { - Await.result(f, TIMEOUT) - } - - def CreateActorNameFromClassName(c: String): String = { - val n = c.replaceFirst("^.*Remotedata", "").replaceAll("\\$.*", "") - Character.toLowerCase(n.charAt(0)) + n.substring(1) - } - -} \ No newline at end of file diff --git a/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala b/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala index 2b9a0bf2b..a847b4f89 100644 --- a/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala +++ b/obp-api/src/main/scala/code/actorsystem/ObpLookupSystem.scala @@ -28,34 +28,6 @@ trait ObpLookupSystem extends MdcLoggable { obpLookupSystem } - def getKafkaActor(actorName: String) = { - - val actorPath: String = { - val hostname = ObpActorConfig.localHostname - val port = ObpActorConfig.localPort - val props_hostname = Helper.getHostname - if (port == 0) { - logger.error("Failed to connect to local Kafka actor") - } - s"akka.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}" - } - - this.obpLookupSystem.actorSelection(actorPath) - } - - def getKafkaActorChild(actorName: String, actorChildName: String) = { - val actorPath: String = { - val hostname = ObpActorConfig.localHostname - val port = ObpActorConfig.localPort - val props_hostname = Helper.getHostname - if (port == 0) { - logger.error("Failed to connect to local Kafka actor") - } - s"akka.tcp://ObpActorSystem_${props_hostname}@${hostname}:${port}/user/${actorName}/${actorChildName}" - } - this.obpLookupSystem.actorSelection(actorPath) - } - def getActor(actorName: String) = { val actorPath: String = { diff --git a/obp-api/src/main/scala/code/bankconnectors/Connector.scala b/obp-api/src/main/scala/code/bankconnectors/Connector.scala index efb4fb06d..5094fd921 100644 --- a/obp-api/src/main/scala/code/bankconnectors/Connector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/Connector.scala @@ -691,8 +691,6 @@ trait Connector extends MdcLoggable { callContext: Option[CallContext] ): OBPReturnType[Box[PhysicalCardTrait]] = Future{(Failure{setUnimplementedError(nameOf(updatePhysicalCard _))}, callContext)} - - //Note: introduce v210 here, is for kafka connectors, use callContext and return Future. def makePaymentv210(fromAccount: BankAccount, toAccount: BankAccount, transactionRequestId: TransactionRequestId,