use of org.apache.activemq.openwire.OpenWireFormat in project activemq-artemis by apache.
the class TcpTransportFactory method compositeConfigure.
@Override
public Transport compositeConfigure(Transport transport, WireFormat format, Map options) {
TcpTransport tcpTransport = transport.narrow(TcpTransport.class);
IntrospectionSupport.setProperties(tcpTransport, options);
Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
tcpTransport.setSocketOptions(socketOptions);
if (tcpTransport.isTrace()) {
try {
transport = TransportLoggerSupport.createTransportLogger(transport, tcpTransport.getLogWriterName(), tcpTransport.isDynamicManagement(), tcpTransport.isStartLogging(), tcpTransport.getJmxPort());
} catch (Throwable e) {
LOG.error("Could not create TransportLogger object for: " + tcpTransport.getLogWriterName() + ", reason: " + e, e);
}
}
boolean useInactivityMonitor = "true".equals(getOption(options, "useInactivityMonitor", "true"));
if (useInactivityMonitor && isUseInactivityMonitor(transport)) {
transport = createInactivityMonitor(transport, format);
IntrospectionSupport.setProperties(transport, options);
}
// Only need the WireFormatNegotiator if using openwire
if (format instanceof OpenWireFormat) {
transport = new WireFormatNegotiator(transport, (OpenWireFormat) format, tcpTransport.getMinmumWireFormatVersion());
}
return super.compositeConfigure(transport, format, options);
}
use of org.apache.activemq.openwire.OpenWireFormat in project activemq-artemis by apache.
the class DataStructureTestSupport method createWireFormat.
protected WireFormat createWireFormat() {
OpenWireFormat answer = new OpenWireFormat();
answer.setCacheEnabled(cacheEnabled);
return answer;
}
use of org.apache.activemq.openwire.OpenWireFormat in project activemq-artemis by apache.
the class ActiveMQMessageTest method testConvertProperties.
public void testConvertProperties() throws Exception {
org.apache.activemq.command.Message msg = new org.apache.activemq.command.Message() {
@Override
public org.apache.activemq.command.Message copy() {
return null;
}
@Override
public void beforeMarshall(WireFormat wireFormat) throws IOException {
super.beforeMarshall(wireFormat);
}
@Override
public byte getDataStructureType() {
return 0;
}
@Override
public Response visit(CommandVisitor visitor) throws Exception {
return null;
}
@Override
public void clearBody() throws JMSException {
}
@Override
public void storeContent() {
}
@Override
public void storeContentAndClear() {
}
};
msg.setProperty("stringProperty", "string");
msg.setProperty("byteProperty", Byte.valueOf("1"));
msg.setProperty("shortProperty", Short.valueOf("1"));
msg.setProperty("intProperty", Integer.valueOf("1"));
msg.setProperty("longProperty", Long.valueOf("1"));
msg.setProperty("floatProperty", Float.valueOf("1.1f"));
msg.setProperty("doubleProperty", Double.valueOf("1.1"));
msg.setProperty("booleanProperty", Boolean.TRUE);
msg.setProperty("nullProperty", null);
msg.beforeMarshall(new OpenWireFormat());
Map<String, Object> properties = msg.getProperties();
assertEquals(properties.get("stringProperty"), "string");
assertEquals(((Byte) properties.get("byteProperty")).byteValue(), 1);
assertEquals(((Short) properties.get("shortProperty")).shortValue(), 1);
assertEquals(((Integer) properties.get("intProperty")).intValue(), 1);
assertEquals(((Long) properties.get("longProperty")).longValue(), 1);
assertEquals(((Float) properties.get("floatProperty")).floatValue(), 1.1f, 0);
assertEquals(((Double) properties.get("doubleProperty")).doubleValue(), 1.1, 0);
assertEquals(((Boolean) properties.get("booleanProperty")).booleanValue(), true);
assertNull(properties.get("nullProperty"));
}
use of org.apache.activemq.openwire.OpenWireFormat in project activemq-artemis by apache.
the class MulticastTransportTest method createProducer.
@Override
protected Transport createProducer() throws Exception {
LOG.info("Producer using URI: " + multicastURI);
// we are not using the TransportFactory as this assumes that
// transports talk to a server using a WireFormat Negotiation step
// rather than talking directly to each other
OpenWireFormat wireFormat = createWireFormat();
MulticastTransport transport = new MulticastTransport(wireFormat, new URI(multicastURI));
transport.setLoopBackMode(false);
transport.setSequenceGenerator(new IntSequenceGenerator());
return new CommandJoiner(transport, wireFormat);
}
use of org.apache.activemq.openwire.OpenWireFormat in project activemq-artemis by apache.
the class MulticastTransportTest method createConsumer.
@Override
protected Transport createConsumer() throws Exception {
OpenWireFormat wireFormat = createWireFormat();
MulticastTransport transport = new MulticastTransport(wireFormat, new URI(multicastURI));
transport.setLoopBackMode(false);
transport.setSequenceGenerator(new IntSequenceGenerator());
return new CommandJoiner(transport, wireFormat);
}
Aggregations