////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

Since Grails 3.2, you can use https://github.com/ReactiveX/RxJava[RxJava] to write reactive logic in your Grails controllers that leverages the underlying containers asynchronous processing capabilities.

To get started simply declare a dependency on the plugin in `build.gradle`:

[source,groovy]
.build.gradle
----
dependencies {
    //...
    implementation 'org.apache.grails:grails-rxjava3'
}
----

You can then return `rx.Observable` as a return value from any controller and Grails will automatically apply the following steps:

1. Create a new asynchronous request
2. Spawn a new thread that subscribes to the observable
3. When the observable emits a result, process the result using the link:{controllersRef}respond.html[respond] method.

For more detailed instructions on how to use the RxJava plugin see the https://grails-plugins.github.io/grails-rxjava/latest/[user guide documentation] for the plugin.
