# tibemsAdmin_GetSubscriptions

Function

## Purpose

Return subscriptions matching the specified filters.

## C Declaration

    tibems_status tibemsAdmin_GetSubscriptions(
        tibemsAdmin admin,
        tibemsCollection* collection,
        tibems_int filterFlags,
        const char* name,
        const char* topicName);

## COBOL Call

    CALL "tibemsAdmin_GetSubscriptions"
     USING BY VALUE admin,
           BY REFERENCE collection,
           BY VALUE filterFlags,
           BY REFERENCE name,
           BY REFERENCE topicName,
           RETURNING tibems-status
    END-CALL.

Note: `collection` has usage pointer.

## Parameters

Parameter | Description
--- | ---
`admin` | Get information about subscriptions using this administration connection.
`collection` | Store the returned subscription data in the location specified here, as a collection of tibemsSubscriptionInfo objects.
`filterFlags` | Value can be any combination of the flags: `TIBEMS_SUBSCRIPTIONS_FILTER_DURABLE_ONLY` `TIBEMS_SUBSCRIPTIONS_FILTER_NO_DURABLE` `TIBEMS_SUBSCRIPTIONS_FILTER_SHARED_ONLY` `TIBEMS_SUBSCRIPTIONS_FILTER_NO_SHARED`
`name` | Specifies that only subscriptions with this name should be returned.
`topicName` | Specifies that only subscriptions on this topic name should be returned.

## Remarks

Return a list of all subscriptions that match the specified filters. The subscriptions are returned in a `tibemsCollection`; if no subscription matching the filter criteria exist in the server, then no `tibemsCollection` is returned.

The returned subscriptions are not sorted and are placed in the `tibemsCollection` object in any order. Your application may need to sort the subscriptions into a specific order.

For example, the following returns all shared subscriptions known to the server:

    tibemsAdmin      admin;
    tibemsCollection subscriptionsInfo;
    tibems_status    status;

    status = tibemsAdim_GetSubscriptions(admin, &subscriptionsInfo, 0, NULL, NULL);

The following returns all durable (shared or not shared) subscriptions known to the server:

    tibemsAdmin      admin;
    tibemsCollection subscriptionsInfo;
    tibems_status    status;

    status = tibemsAdim_GetSubscriptions(admin, &subscriptionsInfo,  TIBEMS_SUBSCRIPTIONS_FILTER_DURABLE_ONLY, NULL, NULL);

The following returns all shared durable subscriptions on any topic matching topic news.*:

    tibemsAdmin      admin;
    tibemsCollection subscriptionsInfo;
    tibems_status    status;

    status = tibemsAdim_GetSubscriptions(admin, &subscriptionsInfo,  TIBEMS_SUBSCRIPTIONS_FILTER_DURABLE_ONLY + TIBEMS_SUBSCRIPTIONS_FILTER_SHARED_ONLY, NULL, "news.*");

## Status Codes

Status Code | Description
--- | ---
`TIBEMS_TIMEOUT` | The administrative query timed out while waiting for a server response.
`TIBEMS_NOT_FOUND` | No subscription found matching the specified filters.

Copyright © Cloud Software Group, Inc. All rights reserved.