11package app .softnetwork .notification .api
22
33import akka .actor .typed .ActorSystem
4- import akka .http .scaladsl .model .{HttpRequest , HttpResponse }
5- import app .softnetwork .notification .handlers .NotificationHandler
4+ import app .softnetwork .notification .handlers .AllNotificationsHandler
65import app .softnetwork .notification .launch .NotificationApplication
76import app .softnetwork .notification .model .Notification
87import app .softnetwork .notification .persistence .query .{
@@ -16,19 +15,17 @@ import app.softnetwork.notification.persistence.typed.{
1615import app .softnetwork .persistence .jdbc .query .{JdbcJournalProvider , JdbcSchema , JdbcSchemaProvider }
1716import app .softnetwork .scheduler .api .SchedulerApi
1817
19- import scala . concurrent . Future
18+ trait AllNotificationsApi extends SchedulerApi with NotificationApplication [ Notification ] {
2019
21- trait NotificationApi extends SchedulerApi with NotificationApplication {
22-
23- override def notificationBehavior : ActorSystem [_] => Option [NotificationBehavior [Notification ]] =
24- _ => Some (AllNotificationsBehavior )
20+ override def notificationBehaviors : ActorSystem [_] => Seq [NotificationBehavior [Notification ]] =
21+ _ => Seq (AllNotificationsBehavior )
2522
2623 override def scheduler2NotificationProcessorStream
2724 : ActorSystem [_] => Option [Scheduler2NotificationProcessorStream ] =
2825 sys =>
2926 Some (
3027 new Scheduler2NotificationProcessorStream ()
31- with NotificationHandler
28+ with AllNotificationsHandler
3229 with JdbcJournalProvider
3330 with JdbcSchemaProvider {
3431 override val tag = s " ${AllNotificationsBehavior .persistenceId}-scheduler "
@@ -42,17 +39,17 @@ trait NotificationApi extends SchedulerApi with NotificationApplication {
4239 sys =>
4340 Some (
4441 new NotificationCommandProcessorStream
45- with NotificationHandler
42+ with AllNotificationsHandler
4643 with JdbcJournalProvider
4744 with JdbcSchemaProvider {
4845 override lazy val schemaType : JdbcSchema .SchemaType = jdbcSchemaType
4946 override implicit def system : ActorSystem [_] = sys
5047 }
5148 )
5249
53- override def grpcServices
54- : ActorSystem [_] => Seq [ PartialFunction [ HttpRequest , Future [ HttpResponse ]]] = system =>
55- Seq (
56- NotificationServiceApiHandler .partial( NotificationServer (system))(system )
57- )
50+ /** initialize all notification servers
51+ */
52+ override def notificationServers : ActorSystem [_] => Seq [ NotificationServer ] = sys =>
53+ Seq ( AllNotificationsServer (sys) )
54+
5855}
0 commit comments