Search in sources :

Example 1 with IpcEnvelop

use of io.vertx.tp.ipc.eon.IpcEnvelop in project vertx-zero by silentbalanceyh.

the class DataEncap method consume.

/**
 * Middle process
 *
 * @param request
 * @param type
 */
public static IpcData consume(final IpcRequest request, final IpcType type) {
    final IpcData ipcData = new IpcData();
    final IpcEnvelop envelop = request.getEnvelop();
    final String data = envelop.getBody();
    final JsonObject json = new JsonObject(data);
    // Address convert
    if (json.containsKey("address")) {
        ipcData.setAddress(json.getString("address"));
        json.remove("address");
    }
    ipcData.setData(Buffer.buffer(data));
    ipcData.setType(type);
    return ipcData;
}
Also used : JsonObject(io.vertx.core.json.JsonObject) IpcEnvelop(io.vertx.tp.ipc.eon.IpcEnvelop) IpcData(io.vertx.up.atom.flux.IpcData)

Aggregations

JsonObject (io.vertx.core.json.JsonObject)1 IpcEnvelop (io.vertx.tp.ipc.eon.IpcEnvelop)1 IpcData (io.vertx.up.atom.flux.IpcData)1