org.rribbit.RRB Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rribbit Show documentation
Show all versions of rribbit Show documentation
RRiBbit is an Open Source Java application framework that eliminates dependencies and simplifies code structure. It can be used as an Eventbus, but improves upon
this by being compatible with existing code and allowing bidirectional communication between components. It also supports Remoting, so that you can use Eventbuses that
run on other machines, complete with failover, loadbalancing and SSL/TLS support.
/**
* Copyright (C) 2012-2018 RRiBbit.org
*
* 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 org.rribbit;
/**
* RRB is a convenience class that provides static access to a global {@link RequestResponseBus}. This is ideal for small-scaled Java Applications.
*
* Larger applications will probably want to use a {@link RequestResponseBus} initialized in their Spring Context. Everyone who wants the {@link RequestResponseBus} then has to
* get it from the Spring Context. Alternatively, you could first initialize the Spring Context and then get the {@link RequestResponseBus} out of it and set it in RRB, if that
* is convenient for your application.
*
* @author G.J. Schouten
*
*/
public final class RRB {
private static RequestResponseBus requestResponseBus;
/**
* This class is not supposed to be instantiated.
*/
private RRB() {}
/**
* Sets the global static {@link RequestResponseBus}.
*
* @param requestResponseBus
*/
public static void setRequestResponseBus(RequestResponseBus requestResponseBus) {
RRB.requestResponseBus = requestResponseBus;
}
/**
* Gets the global static {@link RequestResponseBus}. This method is intended for people who don't like static imports and prefer syntax such as RRB.get().send(...);
*
* @return the global static {@link RequestResponseBus}
*/
public static RequestResponseBus get() {
return requestResponseBus;
}
/**
* Gets the global static {@link RequestResponseBus}. This method is intended for people who do like static imports and prefer syntax such as rrb().send(...);
*
* @return the global static {@link RequestResponseBus}
*/
public static RequestResponseBus rrb() {
return requestResponseBus;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy