Amazon SQS

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pink
Posts: 280
Joined: Wed Mar 12, 2014 6:18 pm

Amazon SQS

Post by pink » Fri Jan 23, 2015 12:35 pm

I am working on a program to pile through and report back on a large output file of JSON objects from either Amazon SQS or SNS.

Essentially, this is the tail end of an email process which should output the delivery results of a huge batch of messages.

Here's my problem, I haven't figured out a way to actually pull down the messages in Livecode, however I can do it rather simply in Python.

My questions:

1. Is anyone already familiar with using Amazon SQS or SNS in LiveCode?

2. I know that shell() can run external commands, but can it send a series of commands interactively? (in other words can I run multiple Python lines through shell?)
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Amazon SQS

Post by FourthWorld » Fri Jan 23, 2015 4:31 pm

Hey Greg - good to see you here.

I haven't used Amazon services myself, so hopefully someone else here can chime in on that.

The second question appears to be two separate ones:
a) "can it send a series of commands interactively?"
b) "can I run multiple Python lines through shell?"

In brief, no and yes, respectively.

In not-so-brief:

LiveCode's shell context is non-interactive. Being called from a function, there's no opportunity to interact with the shell as there is in the terminal. For example, if a shell command requires a password prompt, such a remote rsync, the script will simply fail due to lack of authentication. However, that's a good example because there are other, better, means of logging in without a password, such as shared SSH keys. Depending on the prompt, there may be ways to embed responses to shell prompts within the script. This is probably more a question for a bash forum, but if you have a specific case in mind feel free to post the details here and we'll see what we can come up with.

LiveCode's shell can send multiple commands, delimited by semi-colons. If you need to send larger scripts than can be conveniently expressed in a single delimited line, you can write those in a shell script and call that script from LiveCode. Note that if a command changes the execution context, such as logging into a remote host, neither LiveCode nor bash will automatically change the context to the new session as happens in the terminal. There are ways of specifying the context, however, so once again if you have a particular use case in mind please post the details and we'll see what we can find to help.

As a general rule, given the range of good diagnostic tools available in terminal, it's a good idea to craft any command-line solution in a bash script first and make sure it can run flawlessly from the terminal before using it with LiveCode's shell function. For this reason, bookmarking a forum for bash and/or the specific Amazon services you're working with may be helpful, as many aspects will be outside the scope of LiveCode itself.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply