Feeds

Programming message services in Java

Asynchronous interactions seem to be the way of the future

SANS - Survey on application security programs

Publish destinations

How a destination is published is message service dependent. In the case of the JBossMQ message server a destination can be published by providing an entry in the JBossmq-destinations-service.xml file (found under the \server\default\deploy\jms directory for the default Jboss server configuration). By default a number of queues are already defined and we will use one of these, the queue/testQueue. By contrast, in WebLogic and WebSphere queues can be defined using the application server consoles.

The entry for the JBossmq-destinations-service.xml file for the queue/testQueue is presented below:

  <mbean code="org.jboss.mq.server.jmx.Queue"
         name="jboss.mq.destination:service=Queue,name=testQueue">
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
    <attribute name="MessageCounterHistoryDayLimit">-1</attribute>
    <attribute name="SecurityConf">
      <security>
        <role name="guest" read="true" write="true"/>
        <role name="publisher" read="true" write="true" create="false"/>
        <role name="noacc" read="false" write="false" create="false"/>
      </security>
    </attribute>
  </mbean>

Define a client

To send a message to a JMS message server queue, there are a number of steps that must be performed. These steps are the same whether you wish to send the message from a stand-alone application, from a Servlet or JSP, or indeed from an Enterprise JavaBean. These steps are:

Step 1: Obtain a queue connection factory. A queue connection factory is used to create the queue connection object used to handle the connection to the message servers’ queue.

Step 2: Create a queue connection. This is done by calling the createQueueConnection method on the factory object just obtained.

Step 3: Create a queue session. A queue session is obtained from the queue connection, as illustrated below:

QueueSession qs = 
             qc.createQueueSession(false, 
             Session.AUTO_ACKNOWLEDGE);

The first argument to the createQueueSession method above indicates that this is not part of a transaction. The second argument indicates that the queue session automatically acknowledges messages when they have been received successfully. Until a JMS message has been acknowledged, it is not considered to be successfully consumed.

Step 4: Look up the queue. This is done by using the initial context object we created earlier and looking up the queue using its JNDI name (e.g. queue/testQueue).

Step 5: Create a queue sender. A queue sender is a message producer that allows messages to be sent to the specified queue. A queue sender is created using the createSender method on the queue session:

Step 6: Create the message object.

Step 7: Send the message via the QueueSender object created in step 5.

Step 8: Close the queue connection.

3 Big data security analytics techniques

More from The Register

next story
OpenBSD founder wants to bin buggy OpenSSL library, launches fork
One Heartbleed vuln was too many for Theo de Raadt
Got Windows 8.1 Update yet? Get ready for YET ANOTHER ONE – rumor
Leaker claims big release due this fall as Microsoft herds us into the CLOUD
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Ubuntu 14.04 LTS: Great changes, but sssh don't mention the...
Why HELLO Amazon! You weren't here last time
Patch iOS, OS X now: PDFs, JPEGs, URLs, web pages can pwn your kit
Plus: iThings and desktops at risk of NEW SSL attack flaw
Next Windows obsolescence panic is 450 days from … NOW!
The clock is ticking louder for Windows Server 2003 R2 users
Batten down the hatches, Ubuntu 14.04 LTS due in TWO DAYS
Admins dab straining server brows in advance of Trusty Tahr's long-term support landing
Red Hat to ship RHEL 7 release candidate with a taste of container tech
Grab 'near-final' version of next Enterprise Linux next week
Apple inaugurates free OS X beta program for world+dog
Prerelease software now open to anyone, not just developers – as long as you keep quiet
prev story

Whitepapers

Securing web applications made simple and scalable
In this whitepaper learn how automated security testing can provide a simple and scalable way to protect your web applications.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.