1 /* 2 * Copyright (C) 2019, HuntLabs 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 module hunt.database.driver.postgresql.pubsub.PostgreSQLChannel; 18 19 // import io.vertx.codegen.annotations.Fluent; 20 // import io.vertx.codegen.annotations.VertxGen; 21 // import io.vertx.core.Handler; 22 // import io.vertx.core.streams.ReadStream; 23 24 /** 25 * A channel to Postgres that tracks the subscription to a given Postgres channel using the {@code LISTEN/UNLISTEN} commands. 26 * <p/> 27 * When paused the channel discards the messages. 28 */ 29 // interface PgChannel : ReadStream!(String) { 30 31 // /** 32 // * Set an handler called when the the channel get subscribed. 33 // * 34 // * @param handler the handler 35 // * @return a reference to this, so the API can be used fluently 36 // */ 37 // PgChannel subscribeHandler(VoidHandler handler); 38 39 // /** 40 // * Set or unset an handler to be called when a the channel is notified by Postgres. 41 // * <p/> 42 // * <ul> 43 // * <li>when the handler is set, the subscriber sends a {@code LISTEN} command if needed</li> 44 // * <li>when the handler is unset, the subscriber sends a {@code UNLISTEN} command if needed</li> 45 // * </ul> 46 // * 47 // * @param handler the handler 48 // * @return a reference to this, so the API can be used fluently 49 // */ 50 // override 51 // PgChannel handler(Handler!(String) handler); 52 53 // /** 54 // * Pause the channel, all notifications are discarded. 55 // * 56 // * @return a reference to this, so the API can be used fluently 57 // */ 58 // override 59 // PgChannel pause(); 60 61 // /** 62 // * Resume the channel. 63 // * 64 // * @return a reference to this, so the API can be used fluently 65 // */ 66 // override 67 // PgChannel resume(); 68 69 // /** 70 // * Set an handler to be called when no more notifications will be received. 71 // * 72 // * @param endHandler the handler 73 // * @return a reference to this, so the API can be used fluently 74 // */ 75 // override 76 // PgChannel endHandler(VoidHandler endHandler); 77 78 // override 79 // PgChannel exceptionHandler(Handler!(Throwable) handler); 80 81 // }