rxjava-scheduler-spring-boot-starter

Spring Boot Netflix RxJava Declarative Schedulers

Лицензия

Лицензия

Категории

Категории

Spring Boot Контейнер Микросервисы RxJava Reactive libraries
Группа

Группа

io.jmnarloch
Идентификатор

Идентификатор

rxjava-scheduler-spring-boot-starter
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

rxjava-scheduler-spring-boot-starter
Spring Boot Netflix RxJava Declarative Schedulers
Ссылка на сайт

Ссылка на сайт

https://github.com/jmnarloch/rxjava-scheduler-spring-boot-starter
Система контроля версий

Система контроля версий

https://github.com/jmnarloch/rxjava-scheduler-spring-boot-starter.git

Скачать rxjava-scheduler-spring-boot-starter

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.jmnarloch/rxjava-scheduler-spring-boot-starter/ -->
<dependency>
    <groupId>io.jmnarloch</groupId>
    <artifactId>rxjava-scheduler-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.jmnarloch/rxjava-scheduler-spring-boot-starter/
implementation 'io.jmnarloch:rxjava-scheduler-spring-boot-starter:1.0.0'
// https://jarcasting.com/artifacts/io.jmnarloch/rxjava-scheduler-spring-boot-starter/
implementation ("io.jmnarloch:rxjava-scheduler-spring-boot-starter:1.0.0")
'io.jmnarloch:rxjava-scheduler-spring-boot-starter:jar:1.0.0'
<dependency org="io.jmnarloch" name="rxjava-scheduler-spring-boot-starter" rev="1.0.0">
  <artifact name="rxjava-scheduler-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.jmnarloch', module='rxjava-scheduler-spring-boot-starter', version='1.0.0')
)
libraryDependencies += "io.jmnarloch" % "rxjava-scheduler-spring-boot-starter" % "1.0.0"
[io.jmnarloch/rxjava-scheduler-spring-boot-starter "1.0.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-aop jar 1.3.1.RELEASE
org.springframework.boot : spring-boot-configuration-processor Необязательный jar 1.3.1.RELEASE
io.reactivex : rxjava jar 1.0.14

test (8)

Идентификатор библиотеки Тип Версия
org.mockito : mockito-all jar 1.10.19
junit : junit jar 4.12
org.powermock : powermock-classloading-xstream jar 1.6.5
org.powermock : powermock-module-junit4 jar 1.6.5
org.springframework.boot : spring-boot-starter-web jar 1.3.1.RELEASE
org.powermock : powermock-api-mockito jar 1.6.5
org.powermock : powermock-module-junit4-rule jar 1.6.5
org.springframework.boot : spring-boot-starter-test jar 1.3.1.RELEASE

Модули Проекта

Данный проект не имеет модулей.

Spring Boot Netflix RxJava Declarative Schedulers

A Spring Boot starter for RxJava schedulers integration

Build Status Coverage Status

Setup

Add the Spring Boot starter to your project:

<dependency>
  <groupId>io.jmnarloch</groupId>
  <artifactId>rxjava-scheduler-spring-boot-starter</artifactId>
  <version>1.0.0</version>
</dependency>

Usage

Adds a declarative approach for defining schedulers on the methods RxJava return types: Observable or Single.

  • SubscribeOn - subscribes to the RxJava predefined scheduler.
  • SubscribeOnBean - subscribes to Scheduler defined as bean within application context.

Example

    @Configuration
    @EnableAspectJAutoProxy
    public static class Application {

        @Bean
        public rx.Scheduler executorScheduler() {
            return Schedulers.from(
                    Executors.newSingleThreadExecutor()
            );
        }
    }

Afterwards you can define that your bean uses the custom scheduler or any of the RxJava predefined scheduler by annotating your methods. This is going to work as long as the return type is either Observable or Single.

    @Service
    public class InvoiceService {

        @SubscribeOn(Scheduler.IO)
        public Observable<Invoice> getInvoices() {
            return Observable.just(
                ...
            );
        }

        @SubscribeOnBean("executorScheduler")
        public Observable<Invoice> getUnprocessedInvoices() {
            return Observable.just(
                ...
            );
        }
    }

Note: You need to enable Spring AOP proxies through @EnableAspectJAutoProxy in order to use this extension.

Properties

The only supported property is rxjava.schedulers.enabled which allows to disable this extension.

rxjava.schedulers.enabled=true # true by default

License

Apache 2.0

Версии библиотеки

Версия
1.0.0