Computing messageSize for a durable subscription in KahaDB now runs much
faster (n vs n^2) which is noticable when there are a large number of
pending messages for a durable subscription.
Fixing the processing of KahaUpdateMessageCommand to add the message to
the store if it doesn't exist, instead of ignoring it. This will
prevent message loss in certain cases when the KahaDB index has to be
rebuilt.
Fixing JournalCorruptionEofIndexRecoveryTest class
Because of the size being stored in the message order index, the test
testRecoveryAftercorruptionCheckSumExistingIndex was no longer passing
as that test was corrupting the size value in the journal, but not the
size value in the index. The test now corrupts both values so that the
expect exception occurs again.
Fixing KahaDB so that the correct marshaller is used for the message
keys inside of the message order index. This will ensure that message
size metrics are accurate.
Propertly re-setting the storeOpenWireVersion from the BrokerService
on the KahaDB Metadata if a corrupted index is detected and the
Metadata has to be recreated.
The journalSize counter should be set to 0 after KahaDB is shut down.
Usually, a store is not restarted again after stopping, but if it ever
was the value would be wrong since it wasn't reset back to 0.
Adding metrics to track the pending message size for a queue and for
subscribers. This is useful so that not only the pending count is
known but also the total message size left to consume. Also improving
the message size store tests as well.
Adding support for auto detection of wire protocols over a transport.
OpenWire, AMQP, STOMP, and MQTT can all be detected and the broker
will properly handle each one over a given Transport. Currently
auto TCP, NIO, SSL, and NIO+SSL transports can handle auto-detection
of the wire format and client but support could be added in the
future for other transports like websockets.
This fixes KahaDBStore to properly check for an existing MessageStore
in the cache before creating a new one. This will prevent potential
issues with metrics.
Use the latest openwire version marshallers in the KahaDB store when
starting from a clean install, drop back to the version used in the
existing store if one is found.
Resolves an issue when using mKahaDB that caused a MessageStore
being used by more than one destination to be deleted even though
there was still at least 1 other destination using the store.
Added a getMessageSize method to MessageStore to support retrieving the
total message size of all stored messages for a destination. Added a
new storeMessageSize statistic to DestinationStatistics.
The code that adds subscriptions for retroactive subscribers did not
account for the case where the last ack position in the ackLocations
table is used as a placeholder for the next incoming message and there
may not be an element in the messageReference tracker for that index
especially after restart when the index is reloaded. The code needed to
check this when it iterates of the existing message references to add a
value so to avoid the NPE.
Also cleaned up the MQTT tests such that they place their data dir in
./target so that old stores get removed on 'mvn clean'
This commit is based off a patch submitted by admin@int3solutions.com.
It fixes several locations in the code where there are potential resource leaks.