Web services

Lianja 3.4 provides cross-platform consumer/producer message processing functions which can be used very effectively with web services.

These functions provide cross-platform messaging enabling you to offload slow processing e.g. send email, to a background service.

On Windows the messaging functions are implemented using named pipes and on Linux using POSIX message queues.

Firstly you create your “consumer” and run it as a scheduled task in Windows or a cron job in Linux:

Code:
local mqdes, msg, data

// Create the consumer and wait for a connection
mqdes = mqCreate(“unique_name_of_your_consumer”)

// loop processing messages as they come in from multiple producers
do while .t.
       msg = mqReceive(mqdes)
        if len(msg)=0
            loop
        endif
        data = json_decode(msg)
        // Now process the message which is now encoded as an object
        // …
enddo

Now the producer(s) code looks like this:

Code:
// Create the consumer and wait for a connection
mqdes = mqOpen(“unique_name_of_your_consumer”)
msg = json_encode(anobject)
mqSend(mqdes, msg)
mqClose(mqdes)

Alternatively you can combine all the above code into a shortened version:

Code:
mqSendMessage(“unique_name_of_your_consumer”,  json_encode(anobject))

Q:

In a JavaScript application, I am trying to add a blank grid and then populate it later from an array using additems().

I know this is not yet supported in custom sections, but I thought it may be possible in a standard section.

A:

https://www.lianja.com/community/sho…7702#post17702

Custom grids which can be loaded from an external web service are now implemented in 4.0.1


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.