use of org.jpos.space.SpaceSource in project jPOS by jpos.
the class SendResponse method sendResponse.
private void sendResponse(long id, Context ctx) {
ISOSource src = (ISOSource) ctx.get(source);
ISOMsg m = (ISOMsg) ctx.get(request);
ISOMsg resp = (ISOMsg) ctx.get(response);
try {
if (ctx.getResult().hasInhibit()) {
ctx.log("*** RESPONSE INHIBITED ***");
} else if (ctx.get(TX.toString()) != null) {
ctx.log("*** PANIC - TX not null - RESPONSE OMITTED ***");
} else if (resp == null) {
ctx.log(response + " not present");
} else if (src == null) {
ctx.log(source + " not present");
} else if (!src.isConnected())
ctx.log(source + " is no longer connected");
else {
if (src instanceof SpaceSource)
((SpaceSource) src).init(isp, timeout);
if (src.isConnected() && resp != null) {
headerStrategy.handleHeader(m, resp);
src.send(resp);
}
}
} catch (Throwable t) {
ctx.log(t);
}
}
use of org.jpos.space.SpaceSource in project jPOS by jpos.
the class IncomingListener method process.
public boolean process(ISOSource src, ISOMsg m) {
final Context ctx = new Context();
if (remote)
src = new SpaceSource((LocalSpace) sp, src, timeout);
ctx.put(timestamp, new Date(), remote);
ctx.put(source, src, remote);
ctx.put(request, m, remote);
if (additionalContextEntries != null) {
additionalContextEntries.entrySet().forEach(e -> ctx.put(e.getKey(), e.getValue(), remote));
}
sp.out(queue, ctx, timeout);
return true;
}
Aggregations