Book Image

ADempiere 3.6 Cookbook

Book Image

ADempiere 3.6 Cookbook

Overview of this book

Table of Contents (16 chapters)
ADempiere 3.6 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Building ActiveMQ adapters for ADempiere and VirtueMart


The recipe describes how to build the adapters for ADempiere and VirtueMart, which are the foundations for the integration.

How to do it...

  1. 1. Add<ACTIVEMQ_PATH>\activemq-all-5.3.2.jar to the project libraries.

  2. 2. Create a MQClient.java file, say, in the<ADEMPIERE_SVN>\base\src\compiere\util folder, with the following code:

    package org.compiere.util;
    import org.apache.activemq.transport.stomp.Stomp;
    import org.apache.activemq.transport.stomp.StompConnection;
    import org.apache.activemq.transport.stomp.StompFrame;
    import org.apache.activemq.transport.stomp.Stomp.Headers.Subscribe;
    public class MQClient {
    public static void sendMessage(String messageText) {
    try {
    StompConnection connection = new StompConnection();
    connection.open("localhost", 61613);
    connection.connect("", "");
    connection.send("/queue/test", messageText);
    connection.disconnect();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    public static String receiveMessage...