AMQPMessage extends RefCountMessage implements org.apache.activemq.artemis.api.core.Message { @Override public final long getTimestamp() { if (properties != null && properties.getCreationTime() != null) { return properties.getCreationTime().getTime(); } else { return 0L; } } AMQPMessage(long messageFormat, TypedProperties extraProperties, CoreMessageObjectPools coreMessageObjectPools); protected  AMQPMessage(AMQPMessage copy); protected  AMQPMessage(long messageFormat); final MessageDataScanningStatus messageDataScanned(); ApplicationProperties getDecodedApplicationProperties(); final MessageImpl getProtonMessage(); @Override Object getObjectPropertyForFilter(SimpleString key); final Header getHeader(); final DeliveryAnnotations getDeliveryAnnotations(); final void setDeliveryAnnotationsForSendBuffer(DeliveryAnnotations deliveryAnnotations); final MessageAnnotations getMessageAnnotations(); final Properties getProperties(); final ApplicationProperties getApplicationProperties(); final String toDebugString(); final Section getBody(); final Footer getFooter(); @Override abstract org.apache.activemq.artemis.api.core.Message copy(); @Override final void sendBuffer(ByteBuf buffer, int deliveryCount); ReadableBuffer getSendBuffer(int deliveryCount); @Override void messageChanged(); @Override final ByteBuf getBuffer(); @Override final AMQPMessage setBuffer(ByteBuf buffer); @Override abstract int getEncodeSize(); @Override final void receiveBuffer(ByteBuf buffer); @Override abstract int getMemoryEstimate(); @Override ICoreMessage toCore(CoreMessageObjectPools coreMessageObjectPools); @Override ICoreMessage toCore(); @Override abstract void persist(ActiveMQBuffer targetRecord); @Override abstract int getPersistSize(); @Override abstract void reloadPersistence(ActiveMQBuffer record, CoreMessageObjectPools pools); @Override abstract long getPersistentSize(); @Override abstract Persister<org.apache.activemq.artemis.api.core.Message> getPersister(); @Override abstract void reencode(); final TypedProperties createExtraProperties(); final TypedProperties getExtraProperties(); final AMQPMessage setExtraProperties(TypedProperties extraProperties); @Override final org.apache.activemq.artemis.api.core.Message putExtraBytesProperty(SimpleString key, byte[] value); @Override final byte[] getExtraBytesProperty(SimpleString key); @Override void clearInternalProperties(); @Override final byte[] removeExtraBytesProperty(SimpleString key); @Override final org.apache.activemq.artemis.api.core.Message setConnectionID(String connectionID); @Override final String getConnectionID(); final long getMessageFormat(); @Override final long getMessageID(); @Override final org.apache.activemq.artemis.api.core.Message setMessageID(long id); @Override final long getExpiration(); @Override final AMQPMessage setExpiration(long expiration); @Override final Object getUserID(); final Object getAMQPUserID(); @Override final org.apache.activemq.artemis.api.core.Message setUserID(Object userID); @Override final Object getDuplicateProperty(); @Override boolean isDurable(); @Override final org.apache.activemq.artemis.api.core.Message setDurable(boolean durable); @Override final String getAddress(); @Override final AMQPMessage setAddress(String address); @Override final AMQPMessage setAddress(SimpleString address); @Override final SimpleString getAddressSimpleString(); @Override final long getTimestamp(); @Override final org.apache.activemq.artemis.api.core.Message setTimestamp(long timestamp); @Override final byte getPriority(); @Override final org.apache.activemq.artemis.api.core.Message setPriority(byte priority); @Override final SimpleString getReplyTo(); @Override final AMQPMessage setReplyTo(SimpleString address); @Override final RoutingType getRoutingType(); @Override final org.apache.activemq.artemis.api.core.Message setRoutingType(RoutingType routingType); @Override final SimpleString getGroupID(); @Override final int getGroupSequence(); @Override final Object getCorrelationID(); @Override final org.apache.activemq.artemis.api.core.Message setCorrelationID(final Object correlationID); @Override boolean hasScheduledDeliveryTime(); @Override final Long getScheduledDeliveryTime(); @Override final AMQPMessage setScheduledDeliveryTime(Long time); @Override final Object removeAnnotation(SimpleString key); @Override final Object getAnnotation(SimpleString key); @Override final AMQPMessage setAnnotation(SimpleString key, Object value); @Override org.apache.activemq.artemis.api.core.Message setBrokerProperty(SimpleString key, Object value); @Override Object getBrokerProperty(SimpleString key); @Override final Object removeProperty(SimpleString key); @Override final Object removeProperty(String key); @Override final boolean containsProperty(SimpleString key); @Override final boolean containsProperty(String key); @Override final Boolean getBooleanProperty(String key); @Override final Byte getByteProperty(String key); @Override final Double getDoubleProperty(String key); @Override final Integer getIntProperty(String key); @Override final Long getLongProperty(String key); @Override final Object getObjectProperty(String key); @Override final Short getShortProperty(String key); @Override final Float getFloatProperty(String key); @Override final String getStringProperty(String key); @Override final Set<SimpleString> getPropertyNames(); @Override final Boolean getBooleanProperty(SimpleString key); @Override final Byte getByteProperty(SimpleString key); @Override final byte[] getBytesProperty(String key); @Override final Double getDoubleProperty(SimpleString key); @Override final Integer getIntProperty(SimpleString key); @Override final Long getLongProperty(SimpleString key); @Override final Object getObjectProperty(SimpleString key); @Override final Short getShortProperty(SimpleString key); @Override final Float getFloatProperty(SimpleString key); @Override final String getStringProperty(SimpleString key); @Override final SimpleString getSimpleStringProperty(SimpleString key); @Override final byte[] getBytesProperty(SimpleString key); @Override final SimpleString getSimpleStringProperty(String key); @Override final org.apache.activemq.artemis.api.core.Message putBooleanProperty(String key, boolean value); @Override final org.apache.activemq.artemis.api.core.Message putByteProperty(String key, byte value); @Override final org.apache.activemq.artemis.api.core.Message putBytesProperty(String key, byte[] value); @Override final org.apache.activemq.artemis.api.core.Message putShortProperty(String key, short value); @Override final org.apache.activemq.artemis.api.core.Message putCharProperty(String key, char value); @Override final org.apache.activemq.artemis.api.core.Message putIntProperty(String key, int value); @Override final org.apache.activemq.artemis.api.core.Message putLongProperty(String key, long value); @Override final org.apache.activemq.artemis.api.core.Message putFloatProperty(String key, float value); @Override final org.apache.activemq.artemis.api.core.Message putDoubleProperty(String key, double value); @Override final org.apache.activemq.artemis.api.core.Message putBooleanProperty(SimpleString key, boolean value); @Override final org.apache.activemq.artemis.api.core.Message putByteProperty(SimpleString key, byte value); @Override final org.apache.activemq.artemis.api.core.Message putBytesProperty(SimpleString key, byte[] value); @Override final org.apache.activemq.artemis.api.core.Message putShortProperty(SimpleString key, short value); @Override final org.apache.activemq.artemis.api.core.Message putCharProperty(SimpleString key, char value); @Override final org.apache.activemq.artemis.api.core.Message putIntProperty(SimpleString key, int value); @Override final org.apache.activemq.artemis.api.core.Message putLongProperty(SimpleString key, long value); @Override final org.apache.activemq.artemis.api.core.Message putFloatProperty(SimpleString key, float value); @Override final org.apache.activemq.artemis.api.core.Message putDoubleProperty(SimpleString key, double value); @Override final org.apache.activemq.artemis.api.core.Message putStringProperty(String key, String value); @Override final org.apache.activemq.artemis.api.core.Message putObjectProperty(String key, Object value); @Override final org.apache.activemq.artemis.api.core.Message putObjectProperty(SimpleString key, Object value); @Override final org.apache.activemq.artemis.api.core.Message putStringProperty(SimpleString key, SimpleString value); @Override final org.apache.activemq.artemis.api.core.Message putStringProperty(SimpleString key, String value); @Override final SimpleString getLastValueProperty(); @Override final org.apache.activemq.artemis.api.core.Message setLastValueProperty(SimpleString lastValueName); @Override String toString(); @Override final synchronized boolean acceptsConsumer(long consumer); @Override final synchronized void rejectConsumer(long consumer); static final SimpleString ADDRESS_PROPERTY; static final int DEFAULT_MESSAGE_FORMAT; static final int DEFAULT_MESSAGE_PRIORITY; static final int MAX_MESSAGE_PRIORITY; }
@Test public void testGetTimestampFromMessage() { Date timestamp = new Date(System.currentTimeMillis()); MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); protonMessage.setHeader(new Header()); Properties properties = new Properties(); properties.setCreationTime(timestamp); protonMessage.setProperties(properties); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertEquals(timestamp.getTime(), decoded.getTimestamp()); }
@Test public void testGetTimestampFromMessageWithNoCreateTimeSet() { MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); protonMessage.setHeader(new Header()); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertEquals(0L, decoded.getTimestamp()); }
@Test public void testGetTimestampFromMessageWithNoHeader() { MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertEquals(0L, decoded.getTimestamp()); }