void MamaSymbolListSubscriber::initializeMama ()
{
    mBridgeImpl = Mama::loadBridge (mMiddleware);

    Mama::open ();

    mDefaultQueue = Mama::getDefaultEventQueue (mBridgeImpl);

    mTransport = new MamaTransport;
    mTransport->create (mTransportName, mBridgeImpl);

    if (mDictTransportName != NULL)
    {
        if (strlen(mDictTransportName) == 0)
        {
            mDictTransportName = NULL;
        }
        mDictTransport = new MamaTransport;
        mDictTransport->create (mDictTransportName, mBridgeImpl);
    }
    else
    {
        mDictTransport = mTransport;
    }
    
    mDictSource = new MamaSource (mDictSourceName,
                                  mDictTransport,
                                  mDictSourceName);
}
int main (int argc, const char **argv)
{
    parseCommandLine (argc, argv);
    gBridge = Mama::loadBridge (gMiddleware);

    Mama::open ();

    MamaTransport          transport;
    MamaTimer              timer;
    MamaBasicSubscription  subscription;
    MyHandler              publisher;

    try
    {
        gDefaultQueue = Mama::getDefaultEventQueue (gBridge);
        transport.create (gTransportName, gBridge);
        timer.create (gDefaultQueue, &publisher, gInterval);
        subscription.createBasic (&transport,
                                  gDefaultQueue,
                                  &publisher,
                                  gInBoundTopic);
        publisher.create (&transport, gOutBoundTopic);
    }
    catch (MamaStatus &status)
    {
        cerr << "Caught MAMA exception: " << status.toString () << endl;
        exit (1);
    }

    Mama::start (gBridge);
    Mama::close ();
}
Esempio n. 3
0
void BookPublisher::initializeMama ()
{
    if (!mMiddleware) mMiddleware = "wmw";
    mBridge = Mama::loadBridge (mMiddleware);
    
    Mama::open ();
        
    mSubTransport = new MamaTransport;
    mSubTransport->create (mSubTport, mBridge);
    mSubTransport->setTransportCallback (new TransportCallback ());
        
    mPubTransport = new MamaTransport;
    mPubTransport->create (mPubTport, mBridge);
    mPubTransport->setTransportCallback (new TransportCallback ());    
}
Esempio n. 4
0
void MamaPublisherSample::run()
{
    try
    {
        mBridge = Mama::loadBridge (gMiddleware);

        Mama::open ();

        mDefaultQueue = Mama::getDefaultEventQueue (mBridge);

        mMsg = new MamaMsg();
        mMsg->create();

        mTransport = new MamaTransport();
        mTransport->create (gTransportName, mBridge);

        mTimer = new MamaTimer();
        mTimer->create (mDefaultQueue, this, gInterval);

        mQueueGroup = new MamaQueueGroup(1, mBridge);

        mSubscription = new MamaBasicSubscription();
        mSubscription->createBasic (mTransport,
                                    mDefaultQueue,
                                    this,
                                    gInBoundTopic);

        mPublisher = new MamaPublisher();
        if (gPubCb)
        {
            mPublisher->createWithCallbacks (mTransport,
                                             mQueueGroup->getNextQueue(),
                                             this,
                                             NULL,
                                             gOutBoundTopic,
                                             gSource,
                                             NULL);
        }
        else
        {
            mPublisher->create (mTransport, gOutBoundTopic);
        }
    }
    catch (MamaStatus &status)
    {
        cerr << "Caught MAMA exception: " << status.toString () << endl;
        exit (1);
    }

    Mama::start (mBridge);

    Mama::close ();
}
void BookPublisher::createPublisherTransport (mamaBridge bridge)
{
    mPubTransport = new MamaTransport;
    mPubTransport->create ("pub", bridge);
    mPubTransport->setTransportCallback (new TransportCallback ());
}