Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
18%
200 - 500 GB
26%
500 - 800 GB
3%
800 - 1200 GB
9%
1200 - 1500 GB
12%
1500 - 2000 GB
12%
> 2000 GB
21%
Total votes: 34

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 18th July 2010, 23:06
toolswizard toolswizard is offline
Senior Member
 
Join Date: Aug 2001
Location: USA
Posts: 292
toolswizard is on a distinguished road
Baan: 4c4, 50b, 50c, ERP ln - DB: Informix, Oracle, Sql - OS: Unix, NT, AIX
Working Java JVMI example
Baan: Other/Unknown
C/S: None/Unknown

I have a need to call some Java routines from LN. I have tried to get the JVMI interface example working that is found in the programmers manual.

I have successfully created the session, and created the Java listener, but I have not been able to pass a message between them. If you have a working version, could you please post the Java code, or contact me.
__________________
ToolsWizard
Reply With Quote
  #2  
Old 10th September 2010, 20:28
hessenmob hessenmob is offline
Junior Member
 
Join Date: Mar 2009
Posts: 3
hessenmob is on a distinguished road
Baan: IVc4 - DB: Oracle - OS: AIX
Doesn't work here either. The code in the programmers guide is broken. Some referenced variables are not there. The quality of the product and the corresponding documentation is very flawed. There are copy'n paste errors and so on, many information is missing.
Attached Files
File Type: log bowstart.log (11.3 KB, 105 views)
File Type: txt PlcBucketListener.java.txt (1.9 KB, 121 views)
Reply With Quote
  #3  
Old 12th September 2010, 16:10
toolswizard toolswizard is offline
Senior Member
 
Join Date: Aug 2001
Location: USA
Posts: 292
toolswizard is on a distinguished road
Baan: 4c4, 50b, 50c, ERP ln - DB: Informix, Oracle, Sql - OS: Unix, NT, AIX
Working

Thank you for your reply. I did get it working. It looks similar to yours. I will be posting both the LN script and the Java script.
__________________
ToolsWizard
Reply With Quote
  #4  
Old 13th September 2010, 11:04
hessenmob hessenmob is offline
Junior Member
 
Join Date: Mar 2009
Posts: 3
hessenmob is on a distinguished road
Baan: IVc4 - DB: Oracle - OS: AIX
I fixed it too, here is my JAVA Code, stripped the not working QueuePinger by putting in a Instance of the Programm itsself now i can handle the message in the onReceive Event (Just putting the Message back, no function there).
Problem is, that I am not able to capture the events on the LN side. I want to call async and then I want to be called back. Does anyone know how to implement a Listener on the LN side? Information on this is non existent.

Code:
package de.lti.PlcGenerator;

import com.baan.baanvm.BaanVMImpl;
import com.baan.baanvm.IBaanVM;
import com.baan.baanvm.IBucket;
import com.baan.baanvm.IQueueListener;
import com.baan.baanvm.test.queue.QueuePinger;

public class PlcBucketListener implements IQueueListener
{
	private int m_queueFromERP;
	private int m_queueToERP;
	private static IBaanVM s_iBaanVm = new BaanVMImpl();

	/** constructor of an instance of the listener */
	public PlcBucketListener(int p_idIn, int p_idOut) {
		m_queueFromERP = p_idIn;
		m_queueToERP = p_idOut;
	}

	/**
	 * Called by Infor ERP LN (java.execute.static.method.async). Its main
	 * function is to install an instance of the listener on the queue, and to
	 * initialize all variables
	 */
	public static void installListener(int queueToERP, int queueFromERP)
	{
		try {
			/* install an instance of the listener */
			s_iBaanVm.installListener(queueFromERP, new PlcBucketListener(queueFromERP, queueToERP));
		} catch (Exception e) {
			/* failed to install listener, log error message */
			s_iBaanVm.logMessage(e.toString(), 0);
		}
	}

	/**
	 * This listener method will be called whenever a new bucket appears on the
	 * m_queueFromERP queue
	 */
	public void onReceive(IBucket p_bucket)
	{
		int ret;
		
		if ( p_bucket != null )
		{
			/* we have received data, do something (using the 
			 * IBucket interface to set and retrieve the 
			 * contents) ! 
			 */

			/* for this example, just bounce the bucket back */

			/* place bucket on the queue m_queueToERP */
			if ( (ret = s_iBaanVm.putBucket(m_queueToERP,p_bucket)) < 0 ) 
			{
				/* failed to place bucket on queue to Infor ERP LN*/
				s_iBaanVm.logMessage("Failed to bounce bucket, ret = " + ret, 0);
			}
		}
		else
		{
			/* no bucket received, log a debug message */
			s_iBaanVm.logMessage("QueuePinger(" + m_queueFromERP + ") received: NULL bucket!!!", 0);
		}
	}
}

Baan side

Code:
function call.java.async()
{
    queue.fromJava = java.new.queue()
    queue.toJava = java.new.queue()
	
	string header(30)
	string body(30)

    return.long = java.install.listener(queue.fromJava)

    return.long = java.execute.static.method.sync(
                             "de.lti.PlcGenerator.PlcBucketListener",
                             "installListener", 
                             queue.fromJava, queue.toJava)	
	
	return.long = java.put.bucket(queue.toJava, "BODY1", 30, "HEAD1")
	
	while true
		return.long = java.get.bucket(queue.fromJava, body, 30, header)
		
		if (return.long > 0) then
			message(header & body)
			break
		endif
	endwhile
}
Reply With Quote
  #5  
Old 16th March 2016, 02:41
FrenkR FrenkR is offline
Member
 
Join Date: Jul 2009
Posts: 61
FrenkR is on a distinguished road
Baan: 5 - DB: AS400 - OS: Linux
For those trying this path. I succeeded implementing listener in 3GL only. AFAIK, 4GL(UI) script has no event defined for "EVTCHANNELEVENT". In the beginning of 3GL "main" loop you should configure JVMI queues, install listener and start java app (script as proposed in previous post). After that you implement "message pump" as follows(this is a sample that shows "ping" response from JVMI):
Code:
	| event message loop
	long event(EVTMAXSIZE)
	
	while TRUE
		next.event(event) | read event

		on case evt.type(event)
			case EVTCHANNELEVENT:
					ret = java.get.bucket( queue.to.erp, body, 8000)
				if ret >= 0 then
					message(body)
				else
					message("Error get bucket(Err=%d)", ret)
				endif
				|ToDO: put your logic for processing messages
		endcase
	endwhile
Inside 4GL session, you can start 3GL using "activate/kill" command
Reply With Quote
Sponsored Links
  #6  
Old 9th October 2018, 09:37
jeffersyuan jeffersyuan is offline
Senior Member
 
Join Date: Jan 2006
Posts: 285
jeffersyuan is on a distinguished road
Baan: B4,B50C, LN FP1-FP10 - DB: SQL Server , Oracle - OS: Window , Unix , AIX
Hi,

Any ideas about Synchronous & asynchronous via JVM method?

Thanks.
Jeffers

Quote:
Originally Posted by hessenmob View Post
I fixed it too, here is my JAVA Code, stripped the not working QueuePinger by putting in a Instance of the Programm itsself now i can handle the message in the onReceive Event (Just putting the Message back, no function there).
Problem is, that I am not able to capture the events on the LN side. I want to call async and then I want to be called back. Does anyone know how to implement a Listener on the LN side? Information on this is non existent.

Code:
package de.lti.PlcGenerator;

import com.baan.baanvm.BaanVMImpl;
import com.baan.baanvm.IBaanVM;
import com.baan.baanvm.IBucket;
import com.baan.baanvm.IQueueListener;
import com.baan.baanvm.test.queue.QueuePinger;

public class PlcBucketListener implements IQueueListener
{
	private int m_queueFromERP;
	private int m_queueToERP;
	private static IBaanVM s_iBaanVm = new BaanVMImpl();

	/** constructor of an instance of the listener */
	public PlcBucketListener(int p_idIn, int p_idOut) {
		m_queueFromERP = p_idIn;
		m_queueToERP = p_idOut;
	}

	/**
	 * Called by Infor ERP LN (java.execute.static.method.async). Its main
	 * function is to install an instance of the listener on the queue, and to
	 * initialize all variables
	 */
	public static void installListener(int queueToERP, int queueFromERP)
	{
		try {
			/* install an instance of the listener */
			s_iBaanVm.installListener(queueFromERP, new PlcBucketListener(queueFromERP, queueToERP));
		} catch (Exception e) {
			/* failed to install listener, log error message */
			s_iBaanVm.logMessage(e.toString(), 0);
		}
	}

	/**
	 * This listener method will be called whenever a new bucket appears on the
	 * m_queueFromERP queue
	 */
	public void onReceive(IBucket p_bucket)
	{
		int ret;
		
		if ( p_bucket != null )
		{
			/* we have received data, do something (using the 
			 * IBucket interface to set and retrieve the 
			 * contents) ! 
			 */

			/* for this example, just bounce the bucket back */

			/* place bucket on the queue m_queueToERP */
			if ( (ret = s_iBaanVm.putBucket(m_queueToERP,p_bucket)) < 0 ) 
			{
				/* failed to place bucket on queue to Infor ERP LN*/
				s_iBaanVm.logMessage("Failed to bounce bucket, ret = " + ret, 0);
			}
		}
		else
		{
			/* no bucket received, log a debug message */
			s_iBaanVm.logMessage("QueuePinger(" + m_queueFromERP + ") received: NULL bucket!!!", 0);
		}
	}
}

Baan side

Code:
function call.java.async()
{
    queue.fromJava = java.new.queue()
    queue.toJava = java.new.queue()
	
	string header(30)
	string body(30)

    return.long = java.install.listener(queue.fromJava)

    return.long = java.execute.static.method.sync(
                             "de.lti.PlcGenerator.PlcBucketListener",
                             "installListener", 
                             queue.fromJava, queue.toJava)	
	
	return.long = java.put.bucket(queue.toJava, "BODY1", 30, "HEAD1")
	
	while true
		return.long = java.get.bucket(queue.fromJava, body, 30, header)
		
		if (return.long > 0) then
			message(header & body)
			break
		endif
	endwhile
}
__________________
The Simply is The Best
Reply With Quote
  #7  
Old 12th October 2018, 09:22
giggty's Avatar
giggty giggty is offline
Senior Member
 
Join Date: May 2017
Posts: 114
giggty is on a distinguished road
Baan: Infor ERP 10.6 - DB: MSSQL Server 2008 R2 - OS: Windows Server 2012
What about it? Can you give more details about what are you struggling with?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone using OpenWorld JAMES or Java VM integration for invoking Java from Baan vgobiraj Open World, Portal & Decision Manager 1 29th September 2009 16:59
Working Day abby13 Tools Development 2 26th February 2009 07:16
Java to Baan ks_ks_ Open World, Portal & Decision Manager 4 5th August 2008 12:51
Calling Java application from Baan rajeev2012 Tools Development 5 18th September 2007 05:42
Baan Internet Applications mr_suleyman Tools Development 1 5th September 2006 16:55


All times are GMT +2. The time now is 19:01.


©2001-2018 - Baanboard.com - Baanforums.com