Understanding transaction attributes

In this post we’ll be talking about a subject that is little explored by most of the developers: Transaction attributes. When we’re creating a service (EJB, Spring..), we can either control the transaction manually (BMT – Bean Managed Transaction) or delegate this responsibility to the container (CMT – Container Managed Transaction). CMT is used in most of the cases and with declarative configuration and it’s for this type of configuration that the transaction attributes exist. They define, for example, if your method must or must not be invoked from within a transactional scope.

Just to make things easier and clearer, the term client in this post means the caller, that can be a standalone application, an EJB, a Spring Service, etc.

Continue reading “Understanding transaction attributes”

JMS queues with JEE6 and JBoss 7

This post will show how to configure a JMS queue on JBoss 7.1.1-Final and how to make use of it through a JEE 6 application. Besides, some aspects regarding transactional session and JMS queue’s number of consumers will also be presented.

JMS

This post does not aim to depict JMS in details, but it will give an overview about it.
JMS is part of the Java EE specification and can be considered a MOM (Message Oriented Middleware) which allows clients to exchange asynchronous messages among them.
There are basically two models to exchange messages:

  • Queue: It’s a point-to-point on which one side (producer) pushes a message and places it in a JMS queue and the other side (consumer) pulls the message from the queue. This post will be using this model throughout its example.
  • Topic: Adopts the publish-subscribe model on which one side (publisher) pushes as message on a JSM topic and, for this topic, there can be 0 or more subscribers that receive all the published messages.

More details can be found on the JEE 6 Tutorial.

Continue reading “JMS queues with JEE6 and JBoss 7”