JavaQuick Tip: Java Message Service Class

Quick Tip: Java Message Service Class

Java Developer Tutorials

This Java programming tutorial teaches developers how to create a Java Message Service (JMS) class. Here is some Java example code showcasing how this is done:

*/

public class JmsAppSpecificProps
{
	public static void main(String args[])
	{
		...
	}
	
	protected void writeMessage(String text) throws JMSException
	{
		TextMessage textMessage = publishSession.createTextMessage();
		textMessage.setText(text); //Message
		textMessage.setStringProperty("serverURL","https://10.77.62.12/hint"); //application specific property
		publisher.publish(textMessage); //publishing the message
	}
}

/*

Running this code will result in the following output:

The property serverURL will be published along with the standard message

Read more Java programming and development tutorials.

Latest Posts

Related Stories