use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project fabric8 by jboss-fuse.
the class MessageDispatchMarshaller method tightUnmarshal.
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
MessageDispatch info = (MessageDispatch) o;
info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setRedeliveryCounter(dataIn.readInt());
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project fabric8 by jboss-fuse.
the class MessageMarshaller method tightMarshal1.
/**
* Write the booleans that this object uses to a BooleanStream
*/
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
Message info = (Message) o;
info.beforeMarshall(wireFormat);
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getProducerId(), bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getDestination(), bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getTransactionId(), bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getOriginalDestination(), bs);
rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getMessageId(), bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getOriginalTransactionId(), bs);
rc += tightMarshalString1(info.getGroupID(), bs);
rc += tightMarshalString1(info.getCorrelationId(), bs);
bs.writeBoolean(info.isPersistent());
rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getReplyTo(), bs);
rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
rc += tightMarshalString1(info.getType(), bs);
rc += tightMarshalBuffer1(info.getContent(), bs);
rc += tightMarshalBuffer1(info.getMarshalledProperties(), bs);
rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getDataStructure(), bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getTargetConsumerId(), bs);
bs.writeBoolean(info.isCompressed());
rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
rc += tightMarshalString1(info.getUserID(), bs);
bs.writeBoolean(info.isRecievedByDFBridge());
return rc + 9;
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project fabric8 by jboss-fuse.
the class MessageMarshaller method tightMarshal2.
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
Message info = (Message) o;
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getProducerId(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getDestination(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getTransactionId(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getOriginalDestination(), dataOut, bs);
tightMarshalNestedObject2(wireFormat, (DataStructure) info.getMessageId(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getOriginalTransactionId(), dataOut, bs);
tightMarshalString2(info.getGroupID(), dataOut, bs);
dataOut.writeInt(info.getGroupSequence());
tightMarshalString2(info.getCorrelationId(), dataOut, bs);
bs.readBoolean();
tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
dataOut.writeByte(info.getPriority());
tightMarshalNestedObject2(wireFormat, (DataStructure) info.getReplyTo(), dataOut, bs);
tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
tightMarshalString2(info.getType(), dataOut, bs);
tightMarshalBuffer2(info.getContent(), dataOut, bs);
tightMarshalBuffer2(info.getMarshalledProperties(), dataOut, bs);
tightMarshalNestedObject2(wireFormat, (DataStructure) info.getDataStructure(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure) info.getTargetConsumerId(), dataOut, bs);
bs.readBoolean();
dataOut.writeInt(info.getRedeliveryCounter());
tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
tightMarshalString2(info.getUserID(), dataOut, bs);
bs.readBoolean();
info.afterMarshall(wireFormat);
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project fabric8 by jboss-fuse.
the class BaseDataStreamMarshaller method createThrowable.
private Throwable createThrowable(UTF8Buffer className, UTF8Buffer message) {
try {
Class clazz = Class.forName(className.toString(), false, BaseDataStreamMarshaller.class.getClassLoader());
Constructor constructor = clazz.getConstructor(new Class[] { UTF8Buffer.class });
return (Throwable) constructor.newInstance(new Object[] { message.toString() });
} catch (Throwable e) {
return new OpenwireException(message.toString(), className.toString());
}
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project fabric8 by jboss-fuse.
the class OpenWireFormat method looseMarshalNestedObject.
public void looseMarshalNestedObject(DataStructure o, DataByteArrayOutputStream dataOut) throws IOException {
dataOut.writeBoolean(o != null);
if (o != null) {
if (o instanceof Message) {
if (!isTightEncodingEnabled() && !isCacheEnabled()) {
CachedEncodingTrait encoding = ((Message) o).getCachedEncoding();
if (encoding != null && !encoding.tight() && encoding.version() == getVersion()) {
Buffer buffer = encoding.buffer();
dataOut.write(buffer.data, buffer.offset + 4, buffer.length() - 4);
return;
}
}
}
byte type = o.getDataStructureType();
dataOut.writeByte(type);
DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
if (dsm == null) {
throw new IOException("Unknown data type: " + type);
}
dsm.looseMarshal(this, o, dataOut);
}
}
Aggregations