Spring web-socket message size - activemq

I am implementing an application using spring websockets, stompjs and sockjs. The messages that I am currently sending are working fine when the message size is less than the configured buffer size limit, however its hard for me to judge what the size would be as it would depend on the user selection and the message is then built on it.
My question here is
1) Who handles the message size limit, is it the message broker, right now I am using the default message broker that comes with spring, does it help if I move to ActiveMQ and do I need to do something on ActiveMQ's configuration to change this message size?
2) I was looking into partial messaging in spring websockets, but I couldnt find any demonstration of it. Can you please let me know?

Related

Spiking a message in OpenFire

I wanted to write a plugin in OpenFire to inspect incoming messages between users and possibly stop this message from ongoing to the target recipient.
I can write a plugin that implement PacketInterceptor, but is there an api that supports blocking this packet from being sent or possibly modifying the body.
The rational for this is possibly offensive or illegal content. The times we live in :(
I found a packet filter created to do exactly this.
It can be found at https://www.igniterealtime.org/projects/openfire/plugins/packetfilter/readme.html

what is BlobTransfer Policy in ActiveMQ

In ActiveMQ while using blob messages we use this as broker
String broker1 = "tcp://localhost:7005?jms.blobTransferPolicy.UploadUrl=http://localhost:7005/fileserver/"
Can anybody explain what is UploadUrl and why we need to configure for blob messages(we don't need to configure for text messages). Why it doesn't allow tcp protocol?
So plain text messages are good and easy to use, but needs to be in memory at all times. It works well with a KBs of data, or even a few MB. However, sending very large files, such as initial data loads, large media files or BI data, is not nice to keep around in memory. There may still be a need to pass the message around, route/filter based on message properties, use transactions and similar.
Blob messages is an attempt to solve the need to pass around GBs of data through the semantics of messaging. The trade off is that you have to define a streaming based server somewhere that both sender and receiver can reach. It can be HTTP, FTP, a local file, WebDAV or similar. ActiveMQ comes with a HTTP based fileserver if you have no other file area around.

Send files through RabbitMQ

Is it a good idea to send files with size about 1Mb through RabbitMQ? I want to send message in json format with binary fields corresponding to the files.
And how to do it properly using spring-amqp? Just by publishing object with next class?
class Message {
String field1;
byte[] fileField1;
byte[] fileField2;
}
I would suggest not only reading those links that were posted but also, doing some of your own experimentation. The thing I would be concerned about is performance at the service level and at the client level.
You might want to consider having a server host the files/data and allow rabbitmq just send the message to the consumer with the id of the message in it. So when your consumer gets the message, it sends an HTTP GET request to a service that requests the actual message payload. That way RabbitMQ stays lightweight. You can always add consumers and servers if you need.
That's my opinion without experimenting. You might find that it's still lighting fast with 1MB payloads. That's why I would say to experiment and find out for yourself.
Hope you find this helpful!

ActiveMQ view raw message data in web console

I'm using the web console against my AMQ 5.2 instance successfully, except for I cannot see the content of all of my messages.
If I send a test message using the web console, I can see the sample text content, but I believe the vendor app I am working with has binary or byte array message content.
Is there something I need to do to be able to view this raw data?
Thanks,
To my knowledge, it is not possible to inspect messages in the Admin Console. You can get some statistics (like how many messages have been sent etc.).
ActiveMQ does not unmarshal messages when receiving them (for performance reasons, unmarshalling is rather expensive).
Thus, if you want to have some way to inspect messages for their content, you can basically do 2 things:
Write a consumer which registers for all topics/queues, through which you can see messages' content. Drawback: if you're using queue-based interaction, your "real" consumers will not get all messages
Write an activeMQ plugin which looks at the messages. Have a look at ActiveMQ's Logger Plugin. Then write your own (you'll need the sources to compile it) and load it with ActiveMQ (see the documentation on how to configure ActiveMQ to load plugins). You want to override the send() method which is called whenever someone sends a message to the broker. There you get a reference to the message and can access its content.
Neither of the two messages provides a convenient viewing-mechanism though. You'll have to resort to standard out, or write your own web-based access.
hawtio now shows first 256 chars of messages. Don't know if that is enough for you. Use browse() method.

How can I send a large message to WebSphere MQ through JMS?

There is a built in limitation of 2 MB for the IBM WebSphere MQ JMS interface.
http://www-01.ibm.com/support/docview.wss?uid=swg21221260
Is there a way to bypass that limitation?
The limitation applied to WMQ versions distributed with WAS back at V5.1.1 many years ago. If this is the problem, upgrading to current version of WMQ will resolve it. The current version of WMQ is V7.0.1. V6.0.2 is also still current but will be out of service in September of 2012. V6 & V7 can send and receive messages up to 100MB but WMQ itself defaults to 4MB out of the box. It is necessary to tune parameters of the QMgr, queues and channels if messages larger than 4MB are required but JMS is not a limitation at modern versions.
The WMQ Java/JMS manuals do not specifically mention a maximum size because it is the same as the native WMQ max length of 100MB. However, the WMQ V6 Performance Report provides benchmarks for JMS messages up to 64MB.
Whatever is preventing you from putting a 3MB message isn't a limitation of WMQ's JMS implementation as regards message size. If you have checked MAXMSGL on all of the channels and queues and the QMgr then it's something less obvious but it is configuration.
This might sound arduous, but it is a solution:
Take your message content, convert it into a byte array.
Split the byte array into n sub arrays that are ~< 1.9 MB each.
Start a JMS transaction and send each sub array in a ByteMessage, incrementing the group count:
e.g.
message.setStringProperty("JMSXGroupID", groupId);
message.setIntProperty("JMSXGroupSeq", i);
On the receiver side, you implement a selector to get all the messages in the group as soon as you receive the first message. Retrieve all the messages in the group (hopefully you get them all), sort them correctly, re-create the big byte array, unmarshall it, and you're done.
Trivial really.....
Here's a better example.