Skip to content

Commit 7fd0ef9

Browse files
committed
integrate generic scheduler api
1 parent 70ef504 commit 7fd0ef9

File tree

17 files changed

+52
-31
lines changed

17 files changed

+52
-31
lines changed

api/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ name := "notification-api"
2929

3030
libraryDependencies ++= Seq(
3131
"app.softnetwork.persistence" %% "persistence-jdbc" % Versions.genericPersistence,
32-
"app.softnetwork.persistence" %% "persistence-scheduler-api" % Versions.genericPersistence
32+
"app.softnetwork.scheduler" %% "scheduler-api" % Versions.scheduler
3333
)

api/src/universal/bin/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ function clean() {
2525

2626
export CLUSTER_IP=$(hostname -i | awk '{print $1}')
2727

28-
/opt/docker/bin/persistence-notification-api -DCLUSTER_MANAGEMENT_HOST="$CLUSTER_IP"
28+
/opt/docker/bin/notification-api -DCLUSTER_MANAGEMENT_HOST="$CLUSTER_IP"

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ThisBuild / organization := "app.softnetwork"
3131

3232
name := "notification"
3333

34-
ThisBuild / version := "0.1.4"
34+
ThisBuild / version := "0.1.5"
3535

3636
ThisBuild / scalaVersion := "2.12.15"
3737

common/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ val guavaExclusion = ExclusionRule(organization = "com.google.guava", name="gua
88

99
libraryDependencies ++= Seq(
1010
"app.softnetwork.persistence" %% "persistence-kv" % Versions.genericPersistence,
11-
"app.softnetwork.persistence" %% "persistence-scheduler" % Versions.genericPersistence,
12-
"app.softnetwork.persistence" %% "persistence-scheduler" % Versions.genericPersistence % "protobuf",
11+
"app.softnetwork.scheduler" %% "scheduler-common" % Versions.scheduler,
12+
"app.softnetwork.scheduler" %% "scheduler-common" % Versions.scheduler % "protobuf",
1313
"app.softnetwork.api" %% "generic-server-api" % Versions.genericPersistence,
1414
"app.softnetwork.protobuf" %% "scalapb-extensions" % "0.1.5",
1515
"org.apache.commons" % "commons-email" % "1.5",

core/build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ organization := "app.softnetwork.notification"
55
name := "notification-core"
66

77
libraryDependencies ++= Seq(
8+
"app.softnetwork.scheduler" %% "scheduler-core" % Versions.scheduler,
89
"app.softnetwork.persistence" %% "persistence-session" % Versions.genericPersistence
910
)

core/src/main/scala/app/softnetwork/notification/launch/NotificationApplication.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import app.softnetwork.api.server.launch.HealthCheckApplication
66
import app.softnetwork.notification.api.NotificationServiceApiHandler
77
import app.softnetwork.notification.model.Notification
88
import app.softnetwork.persistence.query.SchemaProvider
9+
import app.softnetwork.schedule.api.SchedulerServiceApiHandler
910

1011
import scala.concurrent.Future
1112

@@ -15,5 +16,7 @@ trait NotificationApplication[T <: Notification]
1516
_: SchemaProvider =>
1617
override def grpcServices
1718
: ActorSystem[_] => Seq[PartialFunction[HttpRequest, Future[HttpResponse]]] = system =>
18-
notificationServers(system).map(NotificationServiceApiHandler.partial(_)(system))
19+
notificationServers(system).map(
20+
NotificationServiceApiHandler.partial(_)(system)
21+
) :+ SchedulerServiceApiHandler.partial(schedulerServer(system))(system)
1922
}

core/src/main/scala/app/softnetwork/notification/persistence/typed/NotificationBehavior.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import app.softnetwork.notification.model._
1616
import app.softnetwork.notification.spi.NotificationProvider
1717
import org.softnetwork.notification.message._
1818
import org.softnetwork.notification.model._
19-
import app.softnetwork.scheduler.config.{Settings => SchedulerSettings}
19+
import app.softnetwork.scheduler.config.SchedulerSettings
2020
import org.softnetwork.notification.model.NotificationStatus._
2121

2222
import scala.language.{implicitConversions, postfixOps}
@@ -96,7 +96,14 @@ trait NotificationBehavior[T <: Notification]
9696
event,
9797
ScheduleForNotificationAdded(
9898
AddSchedule(
99-
Schedule(persistenceId, entityId, notificationTimerKey, delay)
99+
Schedule(
100+
persistenceId,
101+
entityId,
102+
notificationTimerKey,
103+
delay,
104+
Some(true),
105+
Some(now())
106+
)
100107
)
101108
)
102109
)
@@ -232,7 +239,7 @@ trait NotificationBehavior[T <: Notification]
232239
) {
233240
ScheduleForNotificationAdded(
234241
AddSchedule(
235-
Schedule(persistenceId, entityId, notificationTimerKey, delay)
242+
Schedule(persistenceId, entityId, notificationTimerKey, delay, Some(true), Some(now()))
236243
)
237244
)
238245
} else {

project/src/main/scala/app/softnetwork/sbt/build/Versions.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ object Versions {
44

55
val genericPersistence = "0.2.5.15"
66

7+
val scheduler = "0.1.2"
8+
79
val scalatest = "3.1.1"
810
}

testkit/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ organization := "app.softnetwork.notification"
77
name := "notification-testkit"
88

99
libraryDependencies ++= Seq(
10-
"app.softnetwork.persistence" %% "persistence-scheduler-testkit" % Versions.genericPersistence,
10+
"app.softnetwork.scheduler" %% "scheduler-testkit" % Versions.scheduler,
1111
"app.softnetwork.persistence" %% "persistence-session-testkit" % Versions.genericPersistence,
1212
"com.github.kirviq" % "dumbster" % "1.7.1",
1313
"org.rapidoid" % "rapidoid-http-server" % "5.5.5"

testkit/src/main/scala/app/softnetwork/notification/api/NotificationGrpcServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ trait NotificationGrpcServer[T <: Notification]
1010
extends PersistenceScalatestGrpcTest
1111
with NotificationGrpcServices[T]
1212
with InMemoryPersistenceTestKit { _: Suite with NotificationGuardian[T] =>
13-
override lazy val additionalConfig: String = grpcConfig
13+
override lazy val additionalConfig: String = notificationGrpcConfig
1414
}

0 commit comments

Comments
 (0)