com.imperva.stepping.Shouter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stepping Show documentation
Show all versions of stepping Show documentation
Stepping is a framework designed to ease the implementation of data processing solutions.
In use cases where we need to implement data or data-streaming algorithms or any other processing on data, we need to
first handle many different infrastructure issues.
For example, we need to decide how to split the data processing logic into different steps, think about our threading policy,
how to handle communication between the different steps, error handling etc.
One of the most important subjects is the Threading Policy of our solution. For example, we need to think how many threads
to open, have the option to distribute the processing of data to multiple 'executors' in parallel, have a thread-safe
communication layer between the threads etc.
On top of that we also care a lot about the performance of our solution, we want to make sure that the latency added by
these infrastructures is minimal as possible.
Stepping aims to handle many of these aspects so developers can spend their time on the business logic instead of
solving these infrastructure and data flow issues issues over and over again.
package com.imperva.stepping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Shouter {
private final Logger logger = LoggerFactory.getLogger(IRunning.class);
private Container container;
private IExceptionHandler rootExceptionHandler;
public Shouter(Container container, IExceptionHandler rootExceptionHandler) {
this.container = container;
this.rootExceptionHandler = rootExceptionHandler;
}
public void shout(String subjectType, Object value) {
try {
container.getById(subjectType).publish(value);
} catch (Exception e) {
logger.error("Shouter Failed", e);
rootExceptionHandler.handle(new SteppingDistributionException(subjectType, "Distribution FAILED", e));
}
}
public void shout(String subjectType, Data value) {
try {
container.getById(subjectType).publish(value);
} catch (Exception e) {
logger.error("Shouter Failed", e);
rootExceptionHandler.handle(new SteppingDistributionException(subjectType, "Distribution FAILED", e));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy