Artemis - allow attachments to a maximum of 10MiB including any headers. (#452)

Allow attachments to a maximum of 10MiB including any headers.
This commit is contained in:
Konstantinos Chalkias
2017-04-03 18:42:21 +01:00
committed by GitHub
parent 413e39903d
commit dbd82705aa
6 changed files with 79 additions and 15 deletions

View File

@ -90,6 +90,8 @@ class ArtemisMessagingServer(override val config: NodeConfiguration,
val userService: RPCUserService) : ArtemisMessagingComponent() {
companion object {
private val log = loggerFor<ArtemisMessagingServer>()
/** 10 MiB maximum allowed file size for attachments, including message headers. TODO: acquire this value from Network Map when supported. */
@JvmStatic val MAX_FILE_SIZE = 10485760
}
private class InnerState {
@ -171,6 +173,9 @@ class ArtemisMessagingServer(override val config: NodeConfiguration,
idCacheSize = 2000 // Artemis Default duplicate cache size i.e. a guess
isPersistIDCache = true
isPopulateValidatedUser = true
journalBufferSize_NIO = MAX_FILE_SIZE // Artemis default is 490KiB - required to address IllegalArgumentException (when Artemis uses Java NIO): Record is too large to store.
journalBufferSize_AIO = MAX_FILE_SIZE // Required to address IllegalArgumentException (when Artemis uses Linux Async IO): Record is too large to store.
journalFileSize = MAX_FILE_SIZE // The size of each journal file in bytes. Artemis default is 10MiB.
managementNotificationAddress = SimpleString(NOTIFICATIONS_ADDRESS)
// Artemis allows multiple servers to be grouped together into a cluster for load balancing purposes. The cluster
// user is used for connecting the nodes together. It has super-user privileges and so it's imperative that its

View File

@ -152,6 +152,7 @@ class NodeMessagingClient(override val config: NodeConfiguration,
// TODO Add broker CN to config for host verification in case the embedded broker isn't used
val tcpTransport = ArtemisTcpTransport.tcpTransport(ConnectionDirection.Outbound(), serverHostPort, config)
val locator = ActiveMQClient.createServerLocatorWithoutHA(tcpTransport)
locator.setMinLargeMessageSize(ArtemisMessagingServer.MAX_FILE_SIZE)
clientFactory = locator.createSessionFactory()
// Login using the node username. The broker will authentiate us as its node (as opposed to another peer)