Created
September 20, 2010 22:16
-
-
Save gregturn/588747 to your computer and use it in GitHub Desktop.
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 springpython.context import * | |
from springpython.config import * | |
from pika_client import * | |
from ticker_system import * | |
from buy_low_sell_high import * | |
class AppContext(PythonConfig): | |
def __init__(self): | |
PythonConfig.__init__(self) | |
self.exchange_name = "my_exchange" | |
@Object(scope.PROTOTYPE, lazy_init=True) | |
def rabbitmq_publisher(self): | |
return PikaPublisher(exchange_name=self.exchange_name) | |
@Object(scope.PROTOTYPE, lazy_init=True) | |
def rabbitmq_listener(self): | |
buyer = Buyer(self.rabbitmq_publisher(), "", trend=25) | |
print "Buyer = %s" % id(buyer) | |
return buyer | |
@Object(scope.PROTOTYPE, lazy_init=True) | |
def ticker(self): | |
return Ticker(self.rabbitmq_publisher(), "") |
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 springpython.context import * | |
from context import * | |
ctx = ApplicationContext(AppContext()) | |
ctx.get_object("rabbitmq_listener").monitor() |
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 springpython.context import * | |
from context import * | |
ctx = ApplicationContext(AppContext()) | |
ctx.get_object("ticker").monitor() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment