Esempio n. 1
0
mama_status qpidBridge_init (mamaBridge bridgeImpl)
{
    mama_status status         = MAMA_STATUS_OK;
    const char* runtimeVersion = NULL;

    /* Reusable buffer to populate with property values */
    char propString[MAX_INTERNAL_PROP_LEN];
    versionInfo rtVer;

    /* Will set the bridge's compile time MAMA version */
    MAMA_SET_BRIDGE_COMPILE_TIME_VERSION(QPID_BRIDGE_NAME);

    /* Ensure that the qpid bridge is defined as not deferring entitlements */
    status = mamaBridgeImpl_setReadOnlyProperty (bridgeImpl,
                                                 MAMA_PROP_BARE_ENT_DEFERRED,
                                                 "false");

    /* Get the runtime version of MAMA and parse into version struct */
    runtimeVersion = mamaInternal_getMetaProperty (MAMA_PROP_MAMA_RUNTIME_VER);
    strToVersionInfo (runtimeVersion, &rtVer);

    /* NB checks are runtime only - assume build system will prevent accidental
     * compilation against incompatible versions. This is a demonstration to
     * show how you could do runtime version checking. */
    if (1 == rtVer.mMajor)
    {
        mama_log (MAMA_LOG_LEVEL_SEVERE, "qpidBridge_init(): "
                  "This version of the bridge (%s) cannot be used with MAMA %s.",
                  QPID_BRIDGE_VERSION,
                  runtimeVersion);
        return MAMA_STATUS_NOT_IMPLEMENTED;
    }

    return status;
}
Esempio n. 2
0
void zmqBridge_createImpl (mamaBridge* result)
{
    mamaBridgeImpl* bridge = NULL;

    if (NULL == result)
    {
        return;
    }

    /* Create the wrapping MAMA bridge */
    bridge = (mamaBridgeImpl*) calloc (1, sizeof (mamaBridgeImpl));
    if (NULL == bridge)
    {
        mama_log (MAMA_LOG_LEVEL_SEVERE, "zmqBridge_createImpl(): "
                  "Could not allocate memory for MAMA bridge implementation.");
        *result = NULL;
        return;
    }

    /* Populate the bridge impl structure with the function pointers */
    INITIALIZE_BRIDGE (bridge, zmq);

    /* Return the newly created bridge */
    *result = (mamaBridge) bridge;

    mamaBridgeImpl_setReadOnlyProperty (
            (mamaBridge) bridge,
            "mama.zmq.entitlements.deferred", "false");
}