Prev Next

Java / JMS

1. What is JMS (Java Messaging Service)? 2. How JMS (Java messaging service) is different from RPC (Remote Procedure call)? 3. What type of messaging is provided by JMS? 4. Explain Synchronous messaging in JMS. 5. Explain Asynchronous messaging in JMS. 6. What are the advantages of JMS? 7. Different types of Messaging models in JMS. 8. Difference between Point to Point and Publish/Subscribe models in JMS. 9. Difference between topic and queue in JMS. 10. Name some of the other major JMS products available in the market. 11. What are the components of JMS? 12. Explain the role of the JMS provider. 13. Give an example of the publish/subscribe model in JMS. 14. What are the important components of a JMS application? 15. What is JMS administered object? 16. What is JMS session? 17. Difference between durable and non-durable subscription in JMS. 18. Different types of messages available in JMS API. 19. Can JMS be used to send an email? 20. What is Message object in JMS? 21. What is the use of BytesMessage in JMS? 22. Describe the use of StreamMessage in JMS. 23. What is the use of TextMessage in JMS? 24. What is the use of ObjectMessage in JMS? 25. What is the use of MapMessage in JMS? 26. Wat is JMS client? 27. What is JMS producer and Consumer? 28. What is JMS queue? 29. What is JMS topic? 30. Describe Messaging. 31. Explain the difference between Java Mail and JMS Queue. 32. How does a typical JMS client perform the communication using JMS. 33. Define a JMS application. 34. What is the difference between Byte Message and Stream Message? 35. How does the Application server handle the JMS Connection? 36. Explain how JMS works with the J2EE? 37. Can I deliver a Java message to a non-java client? 38. Lets say I had received the JMS message from Queue/Topic and application went down with some issue. So is it possible to retrieve JMS message and continue the execution? if Yes, how is that done. 39. Explain the relationship between the Java Message Service, the Java Transaction API, and the Java Transaction Service. 40. Explain Exclusive and non-exclusive queues. 41. Different Message delivery modes in Solace. 42. Explain Direct and Persistent delivery modes. 43. Explain Message promotion in Solace Message delivery mode. 44. What is Message demotion? 45. What is message replay? 46. Explain request-response message exchange pattern.

1. What is JMS (Java Messaging Service)?

JMS (Java Messaging Service) is a messaging standard that allows J2EE application components to create, send, receive, and read messages. JMS defines an enterprise messaging Java API that makes it easy to write business applications that can exchange business data and events asynchronously and re...

Read full answer

2. How JMS (Java messaging service) is different from RPC (Remote Procedure call)?

JMS provides asynchronous messaging while RPC is synchronous. In RPC the client who invokes the method need to wait for the method to complete the execution and return the control back to the invoker due to its synchronous nature. In JMS the message sender just sends the message to the destinatio...

Read full answer

3. What type of messaging is provided by JMS?

JMS provides two type of messaging. Synchronous Asynchronous

Read full answer

4. Explain Synchronous messaging in JMS.

In synchronous messaging, client waits for the server to respond to a message before it continue its own processing.

Read full answer

5. Explain Asynchronous messaging in JMS.

In asynchronous messaging, client does not wait for a message from the server, instead it automatically creates an event to trigger when response received from server. For example, email and text messaging.

Read full answer

6. What are the advantages of JMS?

Asynchronous messaging . Reliability . Ensures once and only once message delivery. Loose coupling . JMS can be used in heterogeneous environments with decoupled systems that can communicate over system boundaries.

Read full answer

7. Different types of Messaging models in JMS.

There are 2 types of messaging models that JMS provides, Point to Point, and Publish and Subscribe method.

Read full answer

8. Difference between Point to Point and Publish/Subscribe models in JMS.

In point to point communication (one producer and one consumer), the producers and consumers of the message are defined. The producers push the messages in the queues and the receivers retrieve them. It is highly reliable. In publish and subscribe method (one producer and one or more consumer), t...

Read full answer

9. Difference between topic and queue in JMS.

Queuing is used for one to one messaging and it supports point to point messaging model while topic is typically used for one to many messaging and it supports public subscribe model of messaging.

Read full answer

10. Name some of the other major JMS products available in the market.

IBM's MQ Series is one of the most popular product used as Message Oriented Middleware. Some of the other products include SonicMQ, iBus etc. All the J2EE compliant application servers come with its own implementation of JMS.

Read full answer

11. What are the components of JMS?

JMS provider. JMS client. Messages. Administered objects. and Native clients.

Read full answer

12. Explain the role of the JMS provider.

The JMS provider handles data conversion, security of the messages and the client triggering. It specifies the level of encryption, security level of the message and the best-data type for the non-JMS client.

Read full answer

13. Give an example of the publish/subscribe model in JMS.

JMS can be used to broadcast shutdown messages to clients connected to the Weblogic server on module basis. If an application has many modules, each module behaves like a subscriber to a named topic on the server receive and process the message.

Read full answer

14. What are the important components of a JMS application?

Session. Connection. Message. Message Producer and Consumer. Connection factory and destination.

Read full answer

15. What is JMS administered object?

JMS administered object refers to the preconfigured JMS object created by an administrator for the use of JMS clients and placed in JNDI namespace.

Read full answer

16. What is JMS session?

A JMS session is a single-threaded context for sending and receiving JMS messages, could be locally transacted, non-transacted or distributed transacted.

Read full answer

17. Difference between durable and non-durable subscription in JMS.

Durable subscription enables the subscriber to receive all messages from a topic, while a non-durable subscription does not make any guarantees about messages sent by others when a client get disconnected by others.

Read full answer

18. Different types of messages available in JMS API.

The different types of messages available in JMS API are, StreamMessage, TextMessage, BytesMessage, ObjectMessage, and MapMessage.

Read full answer

19. Can JMS be used to send an email?

JMS has no support for email operations.

Read full answer

20. What is Message object in JMS?

Message is a light weight message having only header and properties and no payload. If receivers are to be notified about an event, and no data needs to be exchanged then using Message can be very efficient.

Read full answer

21. What is the use of BytesMessage in JMS?

Byte message is a stream of uninterrupted bytes. It contains an array of primitive bytes in its payload. For the transfer of data between two applications in their native format, byte message is used, which may be not possible with other message types.

Read full answer

22. Describe the use of StreamMessage in JMS.

StreamMessage carries a stream of Java primitive types as it's payload. Unlike ByteMessage, there are restrictions on the way the data is read to avoid erroneous output. StreamMessage prevents reading a long value as short, something that is allowed in case of BytesMessage. SreamMessage enforces ...

Read full answer

23. What is the use of TextMessage in JMS?

TextMessage contains instance of java.lang.String as its payload. Thus it is very useful for exchanging textual data. It can also be used for exchanging complex character data such as an XML document.

Read full answer

24. What is the use of ObjectMessage in JMS?

An ObjectMessage object is used to send a message that contains a serializable object in the Java programming language ("Java object").

Read full answer

25. What is the use of MapMessage in JMS?

A MapMessage holds name-value pair as its payload thus it is similar to the java.util.Properties object of Java. The values can be Java primitives or its wrappers.

Read full answer

26. Wat is JMS client?

An application or process/component that produces and/or receives messages.

Read full answer

27. What is JMS producer and Consumer?

JMS producer is a JMS client that creates and sends messages. JMS consumer is a JMS client that receives messages.

Read full answer

28. What is JMS queue?

A staging area that contains messages that have been sent and are waiting to be read. Note that, contrary to what the name queue suggests, messages don't have to be delivered in the order sent. If the message driven bean pool contains more than one instance then messages can be processed concurre...

Read full answer

29. What is JMS topic?

A distribution mechanism for publishing messages that are delivered to multiple subscribers.

Read full answer

30. Describe Messaging.

Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating,...

Read full answer

31. Explain the difference between Java Mail and JMS Queue.

JMS is the ideal high-performance messaging platform for intrabusiness messaging, with full programmatic control over quality of service and delivery options. JavaMail provides lowest common denominator, slow, but human-readable messaging using infrastructure already available on virtually every ...

Read full answer

32. How does a typical JMS client perform the communication using JMS.

Use JNDI to locate administrative objects. Locate a single ConnectionFactory object. Locate one or more Destination objects. Use the ConnectionFactory to create a JMS Connection. Use the Connection to create one or more Session(s). Use a Session and the Destinations to create the MessageProducers...

Read full answer

33. Define a JMS application.

A JMS application can have one or more JMS clients that exchange messages.

Read full answer

34. What is the difference between Byte Message and Stream Message?

Bytes Message stores data in bytes. Thus the message is one contiguous stream of bytes. While the Stream Message maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. Bytes Message allows data t...

Read full answer

35. How does the Application server handle the JMS Connection?

App server creates the server session and stores them in a pool. Connection consumer uses the server session to put messages in the session of the JMS. Server session is the one that spawns the JMS session. Applications written by Application programmers creates the message listener.

Read full answer

36. Explain how JMS works with the J2EE?

The enterprise JavaBeans components and web components can send or receive JMS message asynchronously. In addition, the application clients can also receive message asynchronously. Using message-driven beans, JMS provider can optionally implement the processing of messages. Message-driven beans a...

Read full answer

37. Can I deliver a Java message to a non-java client?

Yes. After the message is received from Topic or Queue, the message may be converted into a non-java client according to its specification and delivered.

Read full answer

38. Lets say I had received the JMS message from Queue/Topic and application went down with some issue. So is it possible to retrieve JMS message and continue the execution? if Yes, how is that done.

Hi there, thanks for your question. We have Ack (acknowledge) and Nak (not acknowledge) mechanism which may be utilized for this scenario. When your application does receive a JMS message, process it and finally, it may acknowledge the queue so that it may not receive it again anymore. When the a...

Read full answer

39. Explain the relationship between the Java Message Service, the Java Transaction API, and the Java Transaction Service.

The below answer is taken from Oracle website as this is best fit. The Java Transaction API (JTA) provides a client API for delimiting distributed transactions and an API for accessing a resource's ability to participate in a distributed transaction. A JMS client may use JTA to delimit distribute...

Read full answer

40. Explain Exclusive and non-exclusive queues.

Exclusive type queues, allow multiple consumers to connect however always one becomes active and continue to consume message from the queue. When the active consumer crashes, one of the standby consumers become active and continue to consume/process messages from the queue. Exclusive queues facil...

Read full answer

41. Different Message delivery modes in Solace.

Solace PubSub+ event brokers support the below message delivery modes. At most once delivery : brokers provide 2 options Direct and non-persistent message delivery/ Atleast once delivery , brokers provide this mode through persistent( or guaranteed) messaging. Transacted delivery , Solace event b...

Read full answer

42. Explain Direct and Persistent delivery modes.

Direct messaging is ideal for high-speed applications that can accept occasional message loss. Producers publish messages to a topic, received by event broker and delivered to consumers with matching topic subscriptions. Direct messages are not persisted nor acknowledged when received. Persistent...

Read full answer

43. Explain Message promotion in Solace Message delivery mode.

Message promotion refers to a situation where producer sends DIRECT messages however consumer receives it from a guaranteed message endpoint. These messages are non-persistent where the publisher is never back pressured, consumers, receive the data in the most fault-tolerant(persistent) way. In t...

Read full answer

44. What is Message demotion?

Message demotion is the situation where the producer sends Persistent messages, and there are consumers that want to receive these messages but can tolerate lost messages. These consumers can add a topic subscription matching these messages, and receive them in real-time as Direct messages. The p...

Read full answer

45. What is message replay?

Message Replay is a feature that allows an event broker to resend messages to new or existing clients that request them, hours or even days after those messages were first received by the event broker. With replay enabled, event brokers store persistent messages in a replay log.

Read full answer

46. Explain request-response message exchange pattern.

You can use request-reply messaging with Guaranteed Messages when you require a response to each published message from the consuming client that receives those messages. A request-reply messaging model differs from a traditional pub/sub or P2P model, where a message is published to a Topic or Qu...

Read full answer

«
»
JMX

Comments & Discussions