Saturday, October 8, 2016

How to create simple JMS service

1. Create an empty EJB project
    File > New > EJB Project
    Fill in Project Name
    Click Finish.

2. Create a Message Listener
    R-click on MdbTest1 project > New > Message-Driven Bean
    Fill in Java Package, Class Name, Destination name
    Click Finish.

3. add implementation into onMessage(Message message)

    add System.out.printlin() to print out the message content

    Lastly, in @MessageDriven, add the following
        propertyName = "destination", propertyValue = "java:jboss/queues/newQueue")

Complete Class:
package com.kianworknotes.mdb;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

 * Message-Driven Bean implementation class for: Test1
  activationConfig = {         @ActivationConfigProperty(
          propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
          propertyName = "destination", propertyValue = "java:jboss/queues/newQueue") },
  mappedName = "java:jboss/queues/newQueue")
public class Test1 implements MessageListener {
     * Default constructor.
    public Test1() {
        // TODO Auto-generated constructor stub

     * @see MessageListener#onMessage(Message)
    public void onMessage(Message message) {
        // TODO Auto-generated method stub
        TextMessage tm = (TextMessage) message;
        try {
          System.out.println("Received message: "+tm.getText());
        } catch (JMSException e) {


Monday, October 3, 2016

Add and remove JMS queue in JBoss admin console

1. navigate to JBoss Console login page and login as admin

2. navigate JMS Messaging Provider
    Profile > Messaging > Messaging Provider, click View

3. Click JMS Destination

4. under Queues tab, click add

5. fill in the form, click Save

6. Review the Queue summary


Wednesday, September 21, 2016

How to activate / inactivate Portlet in LIferay

1. Login as Liferay Administrator

2. Navigate to Plugins Configuration
    Control Panel > Apps > Plugins Configuration

3. Click on 1 of the plugin from the list, eg. Documents and Media

4. untick the "Active" checkbox.

5. Save.

With these steps, the Documents and Media portlet/plugin has been deactivated.


Tuesday, September 20, 2016

How to get size of a java collection in xhtml

Basically there are 2 ways to get the size of a collection / list in xhtml.
1. jstl function
#{ fn:length(myList) }
2. call the size() function directly
#{ myList.size() }


Tuesday, August 2, 2016

PrimeFaces fileUpload javascript properties


upload content

number of uploaded files
var files = fileuplaod_wgt.uploadContent.find('.files .template-upload');

invalid files



Related Posts Plugin for WordPress, Blogger...