This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prepareExchanges(self, conn): | |
def _openChann(channel): | |
channel.channel_open().addCallback( lambda _, c: c.exchange_declare(exchange=self._exchange, type="direct", durable=True, auto_delete=False), channel ) | |
log.msg("preparing") | |
self._chan = conn.channel(1) | |
return self._chan.addCallback(_openChann) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AI { | |
public AI(envManager) { | |
} | |
public void doSomthing() { | |
envManager.getSomting(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def associateConnection(self, connection): | |
log.msg("associating") | |
self._conn = connection | |
self.openChannel().addCallback(self.write, "Test").addErrback(log.err) | |
def openChannel(self): | |
def _openChann(channel): | |
log.msg("Opening channel") | |
t = channel.channel_open().addCallback( lambda _: channel.queue_declare(queue=self._basename + "_out", durable=True, exclusive=False, auto_delete=False)).addErrback(log.err) | |
t.addCallback(lambda _: channel.queue_bind(queue=self._basename + "_out", exchange=self._exchange, routing_key= "txamqp_" + self._basename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reader: | |
isStop = False | |
queue = None | |
def __init__(self): | |
self.message = [] | |
self.reading = Deferred() | |
def handleMessage(self, msg): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = [] | |
for i in deferreds: | |
l.append(i.get()) | |
dl = DeferredList(l) | |
dl.addCallback(whenAllDone) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.python import log | |
BOT_PROTOCOL_LIST = ['jabber'] | |
class queueReader: | |
def __init__(self, conn, exchange, basename): | |
self._conn = conn | |
self._basename = basename | |
self._exchange = exchange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Handler: | |
def setWorker(self, workerFunc): | |
self._worker = workerFunc | |
def __call__(self, *a, **k): | |
self._worker(*a, **k) | |
handler = Handler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.python import log | |
from txamqp.content import Content | |
BOT_PROTOCOL_LIST = ['jabber'] | |
NON_PERSISTENT = 1 | |
class queueWriter: | |
_chan = None | |
def __init__(self, conn, exchange, basename): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SyncManager { | |
.... | |
public SyncResult getResult() { | |
if (ok) { | |
return new SyncResultOk(); | |
} else { | |
return new SyncResultFail(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SyncResult { | |
SyncResultFail getFail(); | |
SyncResultOk getOk(); | |
bolean isSuccess(); | |
} | |
public class SyncResultFail { | |
private final ActionExecutionError cause; |
OlderNewer