Monday, November 08, 2010 at 12:02 AM.

system.verbs.builtins.betty.rpc.sendOneMessage

on sendOneMessage (adrmsgstring) {
	<<Change Notes
		<<11/11/99; 5:53:09 AM by DW
			<<Called from betty.rpc.agent, it runs in its own thread, allowing asynchronous RPC messages to be sent in parallel. This makes for faster updating of all our servers for My.UserLand story flow, and for preferences flow.
		<<8/20/00; 2:29:47 PM by AR
			<<Added optional username and password parameters for HTTP Basic Authentication.
		<<8/27/00; 11:18:07 AM by AR
			<<Ignore scripterrors thrown by log.addToGuestDatabase.
	local (flsave = false);
	local (adrmsg = address (adrmsgstring)); //thread.easyCall only supports string params
	try {
		if adrmsg^.flshowmessages {
			msg ("betty.rpc.SendOneMessage" + ": Sending " + adrmsg^.procedureName + " to " + adrmsg^.rpcServer + ".")};
		adrmsg^.returnedval = betty.rpc.client (adrmsg^.rpcServer, adrmsg^.rpcPort, adrmsg^.procedureName, @adrmsg^.paramlist, adrmsg^.fldebug, 3600, false, adrmsg^.rpcPath, username:adrmsg^.username, password:adrmsg^.password);
		if adrmsg^.adrCallback != nil {
			adrmsg^.adrCallback^ (adrmsg)};
		try { //8/27/00 AR: ignore errors during logging
			local (adrlog = log.addToGuestDatabase ("asynchRpc"));
			adrlog^ = adrmsg^};
		adrmsg^.flDelete = true;
		if adrmsg^.flshowmessages {
			msg ("")}}
	else { //message failed, reschedule, call error callback
		adrmsg^.tryError = tryError;
		adrmsg^.readyToRunAt = clock.now () + (60 * 5); //try again in five minutes
		flsave = true;
		if not defined (adrmsg^.ctErrors) {
			adrmsg^.ctErrors = 1}
		else {
			adrmsg^.ctErrors++};
		if adrmsg^.adrErrorCallback != nil {
			adrmsg^.adrErrorCallback^ (adrmsg)};
		if adrmsg^.flshowmessages {
			msg ("")}};
	local (fldeleted = false);
	if defined (adrmsg^.fldelete) {
		if adrmsg^.fldelete {
			delete (adrmsg);
			flsave = true;
			fldeleted = true}};
	if not fldeleted {
		adrmsg^.flThreadLaunched = false;
		flsave = true};
	if flsave {
		filemenu.save ()}}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.