JVM technologies Spring certified trainer 5+ years with Scala 3+ years with Kotlin funKTionale KotlinPrimavera RxKotlin original developer and team leader* NOT an expert on reactive programming @dh44t * I hit “Merge” and “Release” buttons
fun RabbitTemplate.privately(message: PrivateMessage): Unit { convertAndSend(message.routingKey, message.body) } fun main(args: Array<String>) { //val log = LoggerFactory.getLogger(RxChatApplicationclass.java) val context = SpringApplication.run(RxChatApplicationclass.java, *args) val props = context[ChatPropertiesclass.java] val name = props.name println(""" $name, Welcome to the RxKotlin Chat -Every message that you send will published in the general chat -To send private messages, use '@' before your friend's alias (e.g.: @JohnDoe Hello) -To exit use the command ':q!' """) val scannerObservable = scanner() val general = generalObservable(name, scannerObservable) val priv = privateObservable(name, scannerObservable) val chat = Chat(context, name, general, priv) scannerObservable.connect() chat.latch.await() }
CachingConnectionFactory().apply { setAddresses(props.addresses) setUsername(props.username) setPassword(props.password) } @Bean open fun template(connectionFactory: ConnectionFactory) = RabbitTemplate(connectionFactory) @Bean open fun admin(connectionFactory: ConnectionFactory) = RabbitAdmin(connectionFactory).apply { afterPropertiesSet() } @Bean open fun privateQueue() = Queue("chat.private.${chatProperties().name}") @Bean open fun generalQueue() = Queue("chat.general.${chatProperties().name}") @Bean open fun chatProperties() = ChatProperties() @Bean open fun generalFanout() = FanoutExchange("chat.general") @Bean open fun binding(generalFanout: FanoutExchange, generalQueue: Queue): Binding = BindingBuilder.bind(generalQueue).to(generalFanout)