diff --git a/build.gradle b/build.gradle index 47017a75..dd9be6f3 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ configurations { } dependencies { - documentation libs.groovy + documentation libs.groovy.core documentation libs.groovy.templates documentation libs.groovy.ant documentation libs.groovy.dateutil @@ -121,6 +121,13 @@ subprojects { repositories { mavenCentral() maven { url 'https://repo.grails.org/grails/core' } + if (libs.versions.groovy.asProvider().get().endsWith('-SNAPSHOT')) { + maven { + name 'JFrog Groovy snapshot repo' + url 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/' + } + } + } tasks.withType(Test).configureEach { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index db058ec5..4241094e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,7 @@ grails-docs = { module = "org.grails:grails-docs", version.ref = "grails" } gpars = { module = 'org.codehaus.gpars:gpars', version.ref = 'gpars' } gorm = { module = 'org.grails:grails-datastore-gorm', version.ref = 'gorm' } gorm-test = { module = 'org.grails:grails-datastore-gorm-test', version.ref = 'gorm' } -groovy = { module = 'org.codehaus.groovy:groovy', version.ref = 'groovy' } +groovy-core = { module = 'org.codehaus.groovy:groovy', version.ref = 'groovy' } groovy-templates = { module = 'org.codehaus.groovy:groovy-templates', version.ref = 'groovy' } groovy-ant = { module = 'org.codehaus.groovy:groovy-ant', version.ref = 'groovy' } groovy-dateutil = { module = 'org.codehaus.groovy:groovy-dateutil', version.ref = 'groovy' } diff --git a/grails-async-core/build.gradle b/grails-async-core/build.gradle index 53a1b7e5..914d63ae 100644 --- a/grails-async-core/build.gradle +++ b/grails-async-core/build.gradle @@ -8,7 +8,7 @@ plugins { group = 'org.grails' dependencies { - implementation libs.groovy + implementation libs.groovy.core implementation libs.javax.annotation.api implementation libs.slf4j.api testImplementation libs.spock.core diff --git a/grails-async-gpars/build.gradle b/grails-async-gpars/build.gradle index bebe29fc..e46b5bdf 100644 --- a/grails-async-gpars/build.gradle +++ b/grails-async-gpars/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':grails-async-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.gpars, { exclude group: 'org.multiverse', module: 'multiverse-core' diff --git a/grails-async-rxjava/build.gradle b/grails-async-rxjava/build.gradle index ff54da1f..bb3f95cd 100644 --- a/grails-async-rxjava/build.gradle +++ b/grails-async-rxjava/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':grails-async-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.rxjava implementation libs.slf4j.api diff --git a/grails-async-rxjava2/build.gradle b/grails-async-rxjava2/build.gradle index 8ebc4538..f83e7169 100644 --- a/grails-async-rxjava2/build.gradle +++ b/grails-async-rxjava2/build.gradle @@ -13,7 +13,7 @@ dependencies { implementation project(':grails-async-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.rxjava2 implementation libs.slf4j.api diff --git a/grails-events-compat/README.md b/grails-events-compat/README.md new file mode 100644 index 00000000..a1e79df6 --- /dev/null +++ b/grails-events-compat/README.md @@ -0,0 +1,3 @@ +## grails-events-compat + +This subproject established a compatibility layer for plugins built with older versions of Grails that worked with Reactor 2 diff --git a/grails-events-compat/build.gradle b/grails-events-compat/build.gradle new file mode 100644 index 00000000..548b99ae --- /dev/null +++ b/grails-events-compat/build.gradle @@ -0,0 +1,26 @@ +plugins { + + id 'groovy' + id 'java-library' + + id 'maven-publish' + id 'signing' + +} + +group = 'org.grails' + +dependencies { + + implementation project(':grails-events-core') + implementation project(':grails-events-transform') + + implementation libs.groovy.core + + implementation libs.slf4j.api + implementation libs.spring.tx + +} + +apply from: file("$rootProject.projectDir/gradle/java-config.gradle") +apply from: file("$rootProject.projectDir/gradle/publishing.gradle") diff --git a/grails-events-compat/src/main/groovy/grails/artefact/Service.groovy b/grails-events-compat/src/main/groovy/grails/artefact/Service.groovy new file mode 100644 index 00000000..45ff49a3 --- /dev/null +++ b/grails-events-compat/src/main/groovy/grails/artefact/Service.groovy @@ -0,0 +1,30 @@ +/* + * Copyright 2014 original authors + * + * Licensed 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 + * + * http://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. + */ +package grails.artefact + +import grails.events.Events + + +/** + * A trait implemented for services that implement events + * + * @author Graeme Rocher + * @since 3.0 + * @deprecated Here for compatibility, do not use directly + */ +@Deprecated +trait Service extends Events { +} \ No newline at end of file diff --git a/grails-events-compat/src/main/groovy/grails/events/Events.groovy b/grails-events-compat/src/main/groovy/grails/events/Events.groovy new file mode 100644 index 00000000..b519b875 --- /dev/null +++ b/grails-events-compat/src/main/groovy/grails/events/Events.groovy @@ -0,0 +1,181 @@ +package grails.events + +import groovy.transform.CompileDynamic +import groovy.transform.CompileStatic +import org.slf4j.LoggerFactory +import reactor.bus.Bus +import reactor.bus.Event +import reactor.bus.EventBus +import reactor.bus.registry.Registration +import reactor.bus.registry.Subscription +import reactor.bus.selector.Selector +import reactor.fn.Consumer + +/** + * Bridges the OLD API to the new + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +@CompileStatic +trait Events { + + EventBus eventBus + + /** + * @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer) + */ + def > Registration> on(Class key, Closure consumer) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + on key.name, consumer + } + + /** + * @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer) + */ + def > Registration> on(Selector key, Closure consumer) { + throw new UnsupportedOperationException("Events of type [Selector] are no longer supported. Use string ids") + } + + /** + * @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer) + */ + def > Registration> on(key, Closure consumer) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + + eventBus.on(key.toString(), consumer) as Registration + } + + /** + * @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer) + */ + def > Registration> on(key, Consumer consumer) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + if(key instanceof CharSequence) { + key = key.toString() + } + on(key) { + consumer.accept(it as E) + } + } + + /** + * @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer) + */ + def > Registration> on(Class type, Consumer consumer) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + on(type.name, consumer) + } + + /** + * Register a {@link reactor.fn.Consumer} to be triggered when a notification matches the given {@link + * Selector}. + * + * @param sel + * The {@literal Selector} to be used for matching + * @param consumer + * The {@literal Consumer} to be triggered + * @param + * The type of the {@link Event} + * + * @return A {@link Subscription} object that allows the caller to interact with the given mapping + */ + def > Registration> on(Selector sel, Consumer consumer) { + throw new UnsupportedOperationException("Events of type [Selector] are no longer supported. Use string ids") + } + + /** + * @see reactor.bus.Bus#notify(java.lang.Object, java.lang.Object) + */ + @CompileDynamic + Bus notify(Object key, Event ev) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + if(eventBus == null) throw new IllegalStateException("EventBus not present. Event notification attempted outside of application context.") + if(ev.replyTo) { + eventBus.sendAndReceive( ev ) { + eventBus.notify(ev.replyTo.toString(), it) + } + } + else { + eventBus.notify key, ev + } + return eventBus + } + + /** + * @see reactor.bus.Bus#notify(java.lang.Object, reactor.bus.Event) + */ + Bus notify(Object key, data) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + eventBus.notify Event.from(key.toString(), data) + return eventBus + } + + def > Bus notify(Object key, Closure supplier) { + if(eventBus == null) throw new IllegalStateException("EventBus not present. Event notification attempted outside of application context.") + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + eventBus.notify( (CharSequence)key.toString(), supplier.call() ) + return eventBus + } + + Bus sendAndReceive(Object key, data, Closure reply) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + eventBus.sendAndReceive(key.toString(), data, reply) + return eventBus + } + + def > Bus sendAndReceive(Object key, Closure reply) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + eventBus.sendAndReceive key.toString(), new grails.events.Event(key.toString(), new Object[0]), reply + return eventBus + } + + + + /** + * Creates an {@link Event} for the given data + * + * @param data The data + * @return The event + */ + def Event eventFor(T data) { + throw new UnsupportedOperationException("Use [grails.events.Event] instead") + } + + /** + * Creates an {@link Event} for the given headers and data + * + * @param headers The headers + * @param data The data + * @return The event + */ + def Event eventFor(Map headers, T data) { + throw new UnsupportedOperationException("Use [grails.events.Event] instead") + } + + /** + * Creates an {@link Event} for the given headers, data and error consumer + * + * @param headers The headers + * @param data The data + * @param errorConsumer The errors consumer + * @return The event + */ + def Event eventFor(Map headers, T data, Closure errorConsumer) { + throw new UnsupportedOperationException("Use [grails.events.Event] instead") + } + + /** + * Clears event consumers for the given key + * @param key The key + * @return True if modifications were made + */ + boolean clearEventConsumers(key) { + LoggerFactory.getLogger(getClass()).warn("The class [${getClass()}] used the legacy Reactor 2 event bus and needs to be re-compiled") + if(eventBus) { + eventBus.unsubscribeAll(key.toString()) + return true + } + return false + } + +} \ No newline at end of file diff --git a/grails-events-compat/src/main/groovy/reactor/bus/Bus.java b/grails-events-compat/src/main/groovy/reactor/bus/Bus.java new file mode 100644 index 00000000..2e2d0748 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/Bus.java @@ -0,0 +1,46 @@ +package reactor.bus; + +import reactor.bus.registry.Subscription; +import reactor.bus.selector.Selector; +import reactor.fn.Consumer; + +/** + * Basic unit of event handling in Reactor. + * + * @author Jon Brisbin + * @author Stephane Maldini + * @author Andy Wilkinson + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +public interface Bus { + + /** + * Are there any {@link Subscription}s with {@link Selector Selectors} that match the given {@code key}. + * + * @param key The key to be matched by {@link Selector Selectors} + * @return {@literal true} if there are any matching {@literal Subscription}s, {@literal false} otherwise + */ + boolean respondsToKey(Object key); + + /** + * Register a {@link reactor.fn.Consumer} to be triggered when a notification matches the given {@link + * Selector}. + * + * @param selector The {@literal Selector} to be used for matching + * @param consumer The {@literal Consumer} to be triggered + * @return A {@link Subscription} object that allows the caller to interact with the given mapping + */ + Subscription> on(final Selector selector, + final Consumer consumer); + + + /** + * Notify this component that an {@link Event} is ready to be processed. + * + * @param key The key to be matched by {@link Selector Selectors} + * @param ev The {@literal Event} + * @return {@literal this} + */ + Bus notify(Object key, T ev); +} diff --git a/grails-events-compat/src/main/groovy/reactor/bus/Event.java b/grails-events-compat/src/main/groovy/reactor/bus/Event.java new file mode 100644 index 00000000..96295e8d --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/Event.java @@ -0,0 +1,42 @@ +package reactor.bus; + +/** + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +public class Event extends grails.events.Event { + private volatile Object replyTo = null; + + public Event(String id, T data, Object replyTo) { + super(id, data); + this.replyTo = replyTo; + } + + public Event(String id, T data) { + super(id, data); + } + + /** + * Get the key to send replies to. + * + * @return The reply-to key + */ + public Object getReplyTo() { + return replyTo; + } + + /** + * Set the {@code key} that interested parties should send replies to. + * + * @param replyTo + * The key to use to notify sender of replies. + * + * @return {@literal this} + */ + public Event setReplyTo(Object replyTo) { + assert replyTo != null : "ReplyTo cannot be null."; + this.replyTo = replyTo; + return this; + } + +} diff --git a/grails-events-compat/src/main/groovy/reactor/bus/EventBus.groovy b/grails-events-compat/src/main/groovy/reactor/bus/EventBus.groovy new file mode 100644 index 00000000..c222e012 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/EventBus.groovy @@ -0,0 +1,36 @@ +package reactor.bus + +import groovy.util.logging.Slf4j +import reactor.bus.registry.Subscription +import reactor.bus.selector.Selector +import reactor.fn.Consumer + +/** + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +@Slf4j +class EventBus implements Bus { + + @Delegate(interfaces = false) grails.events.bus.EventBus eventBus + + EventBus(grails.events.bus.EventBus eventBus) { + this.eventBus = eventBus + } + + @Override + boolean respondsToKey(Object key) { + throw new UnsupportedOperationException() + } + + @Override + Bus notify(Object key, Object ev) { + eventBus.notify(key.toString(), ev) + return this + } + + @Override + Subscription on(Selector selector, Consumer consumer) { + throw new UnsupportedOperationException("Events of type [Selector] are no longer supported. Use string ids") + } +} diff --git a/grails-events-compat/src/main/groovy/reactor/bus/registry/Registration.groovy b/grails-events-compat/src/main/groovy/reactor/bus/registry/Registration.groovy new file mode 100644 index 00000000..628ea459 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/registry/Registration.groovy @@ -0,0 +1,8 @@ +package reactor.bus.registry + +/** + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +interface Registration extends grails.events.subscriber.Subscription{ +} \ No newline at end of file diff --git a/grails-events-compat/src/main/groovy/reactor/bus/registry/Subscription.groovy b/grails-events-compat/src/main/groovy/reactor/bus/registry/Subscription.groovy new file mode 100644 index 00000000..f53423b9 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/registry/Subscription.groovy @@ -0,0 +1,6 @@ +package reactor.bus.registry +/** + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +interface Subscription extends Registration{} \ No newline at end of file diff --git a/grails-events-compat/src/main/groovy/reactor/bus/selector/Selector.java b/grails-events-compat/src/main/groovy/reactor/bus/selector/Selector.java new file mode 100644 index 00000000..ec85d1a1 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/bus/selector/Selector.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2011-2014 Pivotal Software, Inc. + * + * Licensed 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 + * + * http://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. + */ + +package reactor.bus.selector; + +/** + * A {@literal Selector} is a wrapper around an arbitrary object. + * + * @author Jon Brisbin + * @author Stephane Maldini + * @author Andy Wilkinson + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +public interface Selector { + + + /** + * Get the object being used for comparisons and equals checks. + * + * @return The internal object. + */ + Object getObject(); + + /** + * Indicates whether this Selector matches the {@code key}. + * + * @param key The key to match + * + * @return {@code true} if there's a match, otherwise {@code false}. + */ + boolean matches(T key); +} diff --git a/grails-events-compat/src/main/groovy/reactor/fn/Consumer.java b/grails-events-compat/src/main/groovy/reactor/fn/Consumer.java new file mode 100644 index 00000000..c294b851 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/fn/Consumer.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011-2014 Pivotal Software, Inc. + * + * Licensed 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 + * + * http://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. + */ + +package reactor.fn; + +/** + * Implementations accept a given value and perform work on the argument. + * + * @author Jon Brisbin + * @author Stephane Maldini + * + * @param the type of values to accept + * @deprecated Here for compatibility only. Do not use directly + */ +@Deprecated +public interface Consumer { + + /** + * Execute the logic of the action, accepting the given parameter. + * + * @param t The parameter to pass to the consumer. + */ + void accept(T t); + +} diff --git a/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Consumer.groovy b/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Consumer.groovy new file mode 100644 index 00000000..69a103da --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Consumer.groovy @@ -0,0 +1,18 @@ +package reactor.spring.context.annotation + +import java.lang.annotation.Documented +import java.lang.annotation.ElementType +import java.lang.annotation.Inherited +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy +import java.lang.annotation.Target + +/** + * @deprecated No longer necessary, remove from your class + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Documented +@interface Consumer { +} \ No newline at end of file diff --git a/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Selector.groovy b/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Selector.groovy new file mode 100644 index 00000000..e4c22035 --- /dev/null +++ b/grails-events-compat/src/main/groovy/reactor/spring/context/annotation/Selector.groovy @@ -0,0 +1,25 @@ +package reactor.spring.context.annotation + +import org.codehaus.groovy.transform.GroovyASTTransformationClass + +import java.lang.annotation.Documented +import java.lang.annotation.ElementType +import java.lang.annotation.Inherited +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy +import java.lang.annotation.Target + +/** + * @deprecated Use {@link grails.events.subscriber.Subscriber} instead + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Documented +@GroovyASTTransformationClass("org.grails.events.transform.SubscriberTransform") +@interface Selector { + /** + * @return The id of the event + */ + String value() +} \ No newline at end of file diff --git a/grails-events-core/build.gradle b/grails-events-core/build.gradle index c984eac5..59c6db01 100644 --- a/grails-events-core/build.gradle +++ b/grails-events-core/build.gradle @@ -12,7 +12,7 @@ group = 'org.grails' dependencies { - implementation libs.groovy + implementation libs.groovy.core implementation libs.slf4j.api implementation libs.spring.context diff --git a/grails-events-gpars/build.gradle b/grails-events-gpars/build.gradle index 916c1ebd..ea355906 100644 --- a/grails-events-gpars/build.gradle +++ b/grails-events-gpars/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':grails-events-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.gpars, { exclude group: 'org.multiverse', module: 'multiverse-core' diff --git a/grails-events-rxjava/build.gradle b/grails-events-rxjava/build.gradle index 44d7a35c..30df882f 100644 --- a/grails-events-rxjava/build.gradle +++ b/grails-events-rxjava/build.gradle @@ -15,7 +15,7 @@ dependencies { implementation project(':grails-events-core') testImplementation project(':grails-events-transform') - implementation libs.groovy + implementation libs.groovy.core implementation libs.rxjava implementation libs.slf4j.api diff --git a/grails-events-rxjava2/build.gradle b/grails-events-rxjava2/build.gradle index dc22daa1..ab0242af 100644 --- a/grails-events-rxjava2/build.gradle +++ b/grails-events-rxjava2/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':grails-events-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.rxjava2 implementation libs.slf4j.api diff --git a/grails-events-spring/build.gradle b/grails-events-spring/build.gradle index 688f1882..cfe10d3b 100644 --- a/grails-events-spring/build.gradle +++ b/grails-events-spring/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':grails-events-core') - implementation libs.groovy + implementation libs.groovy.core implementation libs.slf4j.api implementation libs.spring.context diff --git a/grails-plugin-async/build.gradle b/grails-plugin-async/build.gradle index 562e2138..61223553 100644 --- a/grails-plugin-async/build.gradle +++ b/grails-plugin-async/build.gradle @@ -14,6 +14,7 @@ plugins { dependencies { api project(':grails-async-core') + api project(':grails-events-compat') api project(':grails-events-core') implementation 'org.grails:grails-core' diff --git a/grails-plugin-events/build.gradle b/grails-plugin-events/build.gradle index 06d996a9..7bc6f50e 100644 --- a/grails-plugin-events/build.gradle +++ b/grails-plugin-events/build.gradle @@ -13,6 +13,7 @@ plugins { dependencies { api project(':grails-events-core') + api project(':grails-events-compat') api project(':grails-events-transform') implementation 'org.grails:grails-core' diff --git a/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy b/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy index 098d0b52..fab26277 100644 --- a/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy +++ b/grails-plugin-events/src/main/groovy/org/grails/plugins/events/EventBusGrailsPlugin.groovy @@ -21,6 +21,7 @@ import grails.plugins.Plugin import org.grails.events.bus.spring.EventBusFactoryBean import org.grails.events.gorm.GormDispatcherRegistrar import org.grails.events.spring.SpringEventTranslator +import reactor.bus.EventBus /** * A plugin that integrates Reactor into Grails @@ -44,6 +45,10 @@ class EventBusGrailsPlugin extends Plugin { grailsEventBus(EventBusFactoryBean) gormDispatchEventRegistrar(GormDispatcherRegistrar, ref("grailsEventBus")) + // the legacy reactor EventBus, here for backwards compatibility + eventBus(EventBus, ref('grailsEventBus')) + + // make it possible to disable reactor events if(config.getProperty(TRANSLATE_SPRING_EVENTS, Boolean.class, false)) { springEventTranslator(SpringEventTranslator, ref('grailsEventBus')) diff --git a/settings.gradle b/settings.gradle index cce5ae20..cbd906f4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,6 +47,7 @@ include 'grails-async-gpars' include 'grails-async-rxjava' include 'grails-async-rxjava2' include 'grails-events-core' +include 'grails-events-compat' include 'grails-events-transform' include 'grails-events-gpars' include 'grails-events-spring'