Best Practices

JMS is a versatile API to support the design of reliable, flexible, and high-performance enterprise applications. One of the basic design guidelines is selecting which messaging model the application will use. Another important decision is what type of message is appropriate. Choosing the message size depends on the type of message you decide to use, which in turn has an impact on application performance. Smaller size gives better performance and vice versa. For example, ByteMessage takes less memory than TextMessage and can support Unicode. ObjectMessage carries a serialized Java object, and you need to specify the transient keyword for members that need not be exchanged to reduce overhead.

In general, a good practice is closing all resources when you are finished with them. JMS resources such as Connection, Session, and producer/consumer must be closed after you are finished.

To enhance reliability, use persistent messages, transacted sessions, durable subscribers, and consumer acknowledgment. In addition, set the TimeToLive value properly, and receive messages asynchronously. Always remember that reliability works against performance, and depending on your application requirements, you must find the balance between them.

JMS clustering is a critical issue in selecting the right JMS provider. Clustering deals with both load balancing and fail-over. This addresses both performance and reliability, and not all JMS providers support clustering of JMS services.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.201.217