Si no puedes gobernarte a ti mismo... ¿cómo sabrás gobernar a los demás?

Hoy he plantado una bolsa de semillas de guisantes en la zona habitual de los guisantes, la tira sur de tierra de la pared oeste.

Comprado en : Carrefour

Precio: xxx €

Java Message Service

Messaging is a method of communication between software components where a Client can send messages to and receive messages from any other Client. Each client connects to a messaging Agent that provides facilities for creating, sending, receiving and reading messages.

  • Loosely coupled, the destination is all that the sender and receiver have in common.
  • Reliable, a message is delivered once and only once, though lower levels of reliability are available.

Java Message Service (JMS) is a Java API defines a common set of interfaces and associated semantics that allow applications written in the Java programming language to communicate with other messaging implementations.

  • Application clients, Enterprise JavaBeans components and web components can send or synchronously receive a JMS Message.
    • Can be set a message listener that allows JMS messages to be delivered to it asynchronously by being notified when a message is available.
  • Message-driven beans enable asynchronous consumption of messages in the EJB container.
    • Applications typically pools message-driven beans to implement concurrent processing of messages.
  • Message send and receive can participate in Java Transaction API (JTA) transactions, which allow JMS operations and database accesses to take place within a single transaction.
  • By accessing the JMS provider through a resource adapter in a Java EE Connector architecture
    • Vendors can create JMS providers that can be plugged in to multiple application servers.
    • Application servers can support multiple JMS providers.

The current release, defined in the JSR-343, is 2.0 and is part of Java EE 7.

JMS API Architecture

JMS API Architecture

A JMS application is composed of the following parts

  • JMS provider is a messaging system that implements the JMS interfaces and provides administrative and control features.
  • JMS clients are the components that produce and consume messages.
  • Messages are the objects that communicate information between the JMS clients.
  • Administered objects are JMS objects configured for the use of clients.
    • Destinations
    • Connection factories
    • Point to Point
    • Publish / Subscriber

Messaging Style

  •  Point to Point
  • Publish / Subscriber

JMS - Messaging Style - Point to Point

JMS - Messaging Style - Publish_Subscriber

Message Consumption

  • Synchronous.
  • Asynchronous, register a message listener with a consumer.

JMS API Programming Model

JMS API Programming Model

The basic building blocks of a JMS application are

  • Administered objects, which are portable (ordinarily defined in a JNDI namespace and injected into JMS clients).
    • Connection Factories, may be ConnectionFactory, QueueConnectionFactory or TopicConnectionFactory.
    • Destinations, objects (queue or topic) a client uses to specify the target of messages it produces and the source of messages it consumes.
    • The behavior of the application will depend on the kind of destination you use and not on the kind of connection factory you use.
  • JMSContext objects, which combine a Connection and a Session in one object
    • A Connection encapsulates a virtual connection with a JMS provider (could represent an open TCP/IP socket between a client and a provider service daemon).
    • A Session is a single-threated context for producing and consuming messages
      • Provides a transactional context with which to group a set of sends and receives into an atomic unit of work.
  • Message producers (JMSProducer), is a lightweight object (so no need to store it) created by a JMSContext or a session and used for sending messages to a destination.
  • Message consumers (JMSConsumer)
    • Can be switched on and off (start / stop).
    • Set a MessageListener for asynchronous messages.
    • Use a Message Selector (a String that contains an expresion) for filtering the messages received.
  • Messages. Can have
    • Header (required): JMSMessageID, JMSCorrelationID, JMSType (TextMessage, MapMessage, BytesMessage, StreamMessage, ObjectMessage, Message), JMSDestination, JMSReplyTo, JMSDeliveryMode, JMSDeliveryTime, JMSExpiration, JMSPriority, JMSTimestamp, JMSRedelivered.
    • Properties (optional), if additional values are needed for compatibility or for filtering (message selectors).
    • Body (optional), each of the 6 possible Message Types has different Message Bodies.

In addition

  • Queue browsers.
  • JMSException is the root class for all checked exceptions in the JMS API, JMSRuntimeException is for all unchecked.


Related concepts

  •  MOM Messaging-Oriented Middleware.

Logger Interceptor

Credits go to Ionut Posea.

class LoggerInterceptor {
    public Object profileSaveMethod(ProceedingJoinPoint call) throws Throwable {
        StopWatch clock = new StopWatch("Profiling:::::" + call.signature + ":::::Args::::::" + call.args );
        try {
            return call.proceed();
        } finally {

Drop all tables from an schema in Oracle

I’ve found a nice solution for dropping all the tables from an existing schema in Oracle, described in this question at stackoverflow. The following script :

SELECT 'drop table '||TABLE_NAME||' cascade constraints;' FROM user_tables;

will display the sentences required for dropping all the tables in the current schema.

How to communicate your Product to your customers


Product Features Product Benefits
“Here’s what our product can do” “Here’s what you can do with our product”
“1GB storage on your MP3 player” “1000 songs in your pocket”

Read here: