Skip to content

Commit b0321fa

Browse files
committed
adds overload to make usage from Java more ergonomic
1 parent 14ea5b1 commit b0321fa

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/main/kotlin/PostgresFlowable.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,22 @@ object PostgresNotifyFlowable {
100100
return retryingObservable.share()
101101
}
102102

103+
/**
104+
* A variant of [forChannels] with defaults set, to make usage from Java more ergonomic
105+
*/
106+
fun forChannels(
107+
jdbcUrl: String,
108+
user: String,
109+
password: String,
110+
channels: List<String>
111+
): Flowable<PGNotification> = forChannels(
112+
jdbcUrl = jdbcUrl,
113+
user = user,
114+
password = password,
115+
pollingPeriodMs = 1000,
116+
reconnectionTimeoutMs = 5000,
117+
channels = channels,
118+
backpressureStrategy = BUFFER
119+
)
120+
103121
}

src/test/kotlin/IntegrationTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ch.sponty.backend.common.database.postgres.PostgresNotifyFlowable
2+
import io.reactivex.BackpressureStrategy
23
import io.reactivex.schedulers.Schedulers
34
import org.junit.jupiter.api.Test
45
import org.postgresql.jdbc.PgConnection
@@ -28,7 +29,7 @@ class PostgresFlowableTest {
2829
password = db.password,
2930
pollingPeriodMs = 1000,
3031
channels = listOf("test"),
31-
backpressureStrategy = BUFFER
32+
backpressureStrategy = BackpressureStrategy.BUFFER
3233
)
3334

3435
val latch = CountDownLatch(4)

0 commit comments

Comments
 (0)