An open API service indexing awesome lists of open source software.

https://github.com/megaprog/async-hessian

The approach to export Hessian service through Servlet 3.0 AsyncContext
https://github.com/megaprog/async-hessian

Last synced: 10 months ago
JSON representation

The approach to export Hessian service through Servlet 3.0 AsyncContext

Awesome Lists containing this project

README

          

# Asynchronous Hessian

The approach to export [Hessian](http://hessian.caucho.com/) service through Servlet 3.0 AsyncContext

## How to get it?

You can use it as a maven dependency:

```xml

org.jmmo
async-hessian
1.1

```

Or download the latest build at:
https://github.com/megaprog/async-hessian/releases

## How to use it?

Create client interface:

```java
public interface HessianServiceInterface {

Integer synchronousCall();

Integer asynchronousCall();
}
```

Create server interface with same method signatures as in client one but asynchronous methods must return CompletableFuture:

```java
public interface HessianServiceInterfaceAsync {

Integer synchronousCall();

CompletableFuture asynchronousCall();
}
```

Implement server asynchronous interface:

```java
public class HessianServiceInterfaceAsyncImpl implements HessianServiceInterfaceAsync {
private static final Logger log = Logger.getLogger(HessianServiceInterfaceAsyncImpl.class.getName());

@Override
public Integer synchronousCall() {
log.info(() -> "Calling from http processing thread");
return 1;
}

@Override
public CompletableFuture asynchronousCall() {
return CompletableFuture.supplyAsync(() -> {
log.info(() -> "Calling from ForkJoinPool thread");
return 2;
});
}
}
```

Export server interface:

```xml


```

Define proxy service bean in client:

```xml


```

See more at client-server example:
https://github.com/Megaprog/async-hessian/tree/master/example