web stats
Custom Library - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 09-23-2015, 02:20 PM
sivakumar_jm sivakumar_jm is offline
What's HL7?
Join Date: Jul 2015
Posts: 4
sivakumar_jm is on a distinguished road
Default Custom Library

Trying to use a custom library of MQLight with Mirth. And getting error "SendClaims() method not found". Is this because of thread implementation ? Attached the source code.

I have tested other sample custom JAR files which works well in my environment.

Any help why this occurs. .
Attached Files
File Type: zip SendMessage.zip (5.1 KB, 8 views)
Reply With Quote
Old 09-23-2015, 02:22 PM
sivakumar_jm sivakumar_jm is offline
What's HL7?
Join Date: Jul 2015
Posts: 4
sivakumar_jm is on a distinguished road

Here is the mirth channel code how the class is invoked.

try {
	logger.info("sending new MQ message started");	

	var mqobj= new Packages.com.MQLight.Client.SendMessage();

	logger.info("sending new MQ message ends");	
catch (err)
	logger.info("error initializing custom mqlight class");	
	logger.error("Error detail: " + err.toString())
Reply With Quote
Old 09-30-2015, 08:43 PM
sivakumar_jm sivakumar_jm is offline
What's HL7?
Join Date: Jul 2015
Posts: 4
sivakumar_jm is on a distinguished road

Got it working, nothing wrong in code, the error was happening because of incorrect JDK version (8.0) used in custom library when Mirth was using version Below is a working version of code if anyone else need to send send AMQP message to IBM MQ

I have one more question though. Code below uses logger and logs information. INFO, WARNING and ERRORS were not appearing in Mirth connect console. What should we do to send back the logging information from custom library to mirth connect console ?. Based on the error messages sent back would like to resubmit for errors like timeout etc.

package com.MQLight.Client;

import java.util.logging.Level;
import java.util.logging.Logger;

import com.ibm.mqlight.api.ClientOptions;
import com.ibm.mqlight.api.CompletionListener;
import com.ibm.mqlight.api.NonBlockingClient;
import com.ibm.mqlight.api.NonBlockingClientAdapter;
import com.ibm.mqlight.api.QOS;
import com.ibm.mqlight.api.SendOptions;
import com.ibm.mqlight.api.SendOptions.SendOptionsBuilder;
import com.ibm.mqlight.api.ClientOptions.ClientOptionsBuilder;

public class SendMessageV4 {
	/** Client that will send and receive messages */
	private NonBlockingClient mqlightClient;

	/** Simple logging */
	private final static Logger logger = Logger.getLogger(SendMessageV4.class.getName());
	public String SendMessage(String message, String service, String topic, String id, Integer ttl) {        

		System.out.println("Initialize SendMessage "); 									
        // Set Client ID
        ClientOptionsBuilder builder = ClientOptions.builder();
        ClientOptions clientOpts = builder.build();
        //Set quality of service, ttl  
        SendOptionsBuilder optsBuilder = SendOptions.builder();
        optsBuilder.setTtl(ttl * 1000);
        SendOptions opts = optsBuilder.build();

        try {

            logger.log(Level.INFO,"Creating an MQ Light client...");

            mqlightClient = NonBlockingClient.create(service, clientOpts, new NonBlockingClientAdapter<Void>() {

              public void onStarted(NonBlockingClient client, Void context) {
              	//System.out.printf("Connected to %s using client-id %s\n", client.getService(), client.getId());

                		new CompletionListener<Void>() {
                	public void onSuccess(NonBlockingClient client, Void context) {
                      logger.log(Level.INFO, "SUCCESS Client id: " + id + " sent message!");
                      System.out.println("Client id: " + id + " sent message!" );									
                      //client.stop(null, null);
                	public void onError(NonBlockingClient client, Void context, Exception exception) {
                      logger.log(Level.INFO,"Error!." + exception.toString());
                      System.out.println("Error!"+ exception.toString()); 									
                      //client.stop(null, null);
                  }, null);                

            }, null);
            //logger.log(Level.INFO,"MQ Light client created. Current state: " + mqlightClient.getState());
          catch (Exception e) {
            logger.log(Level.SEVERE, "Failed to initialise", e);
            throw new RuntimeException(e);
        logger.log(Level.INFO,"Completed initialisation.");
  		System.out.println("Completed SendMessage "); 									
  		return message;
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 10:05 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation