cciGetBrokerInfo

Questa funzione esegue delle query nell'ambiente del broker attuale (ad esempio, per informazioni relative al nome del broker, al nome del gruppo di esecuzione e al nome del gestore code). Le informazioni vengono restituite in una struttura di tipo CCI_BROKER_INFO_ST.
Nota: tale situazione è differente rispetto a cniGetBrokerInfo esistente perché non è necessario fornire un handle CciNode* e cciGetBrokerInfo non restituisce alcuna informazione sul flusso di messaggi. Di conseguenza, cciGetBrokerInfo può essere chiamato dalle funzioni di inizializzazione, ad esempio bipInitializeUserExits, bipGetMessageParserFactory e bipGetMessageFlowNodeFactory.

Sintassi

void cciGetBrokerInfo(
                      int*      returnCode,
                      CCI_BROKER_INFO_ST* broker_info_st);

Parametri

returnCode (output)
Riceve il codice di ritorno dalla funzione (output).
I codici di ritorno possibili sono:
  • CCI_SUCCESS
  • CCI_INV_BROKER_INFO_ST
  • CCI_EXCEPTION
broker_info_st(output)
L'indirizzo di una struttura CCI_BROKER_INFO_ST in cui inserire valori pertinenti in caso di completamento corretto.

Valori di restituzione

Nessuno. Se si verifica un errore, il parametro returnCode indica il motivo dell'errore.

Esempio

	int rc = CCI_SUCCESS;

CCI_BROKER_INFO_ST brokerInfo = {CCI_BROKER_INFO_ST_DEFAULT};

#define INTITIAL_STR_LEN 256
CciChar brokerNameStr[INTITIAL_STR_LEN];
CciChar executionGroupNameStr[INTITIAL_STR_LEN];
CciChar queueManagerNameStr[INTITIAL_STR_LEN];

brokerInfo.brokerName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.brokerName.buffer       = brokerNameStr;

brokerInfo.executionGroupName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.executionGroupName.buffer = executionGroupNameStr;

brokerInfo.queueManagerName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.queueManagerName.buffer = queueManagerNameStr;

cciGetBrokerInfo(&rc,&brokerInfo);

/* nel caso in cui i buffer fossero troppo brevi*/
if ((brokerInfo.brokerName.bytesOutput         < brokerInfo.brokerName.dataLength)  ||
    (brokerInfo.executionGroupName.bytesOutput < brokerInfo.executionGroupName.dataLength) ||
    (brokerInfo.queueManagerName.bytesOutput   < brokerInfo.queueManagerName.dataLength))  {

  /*almeno uno dei buffer era troppo breve, necessario ulteriore tentativo*/
  /* è improbabile che le dimensioni iniziali fossero abbastanza estese*/

  brokerInfo.brokerName.bufferLength =
     brokerInfo.brokerName.dataLength;
  brokerInfo.brokerName.buffer       = 
    (CciChar*)malloc (brokerInfo.brokerName.bufferLength * sizeof(CciChar));

  brokerInfo.executionGroupName.bufferLength = 
    brokerInfo.executionGroupName.dataLength;
  brokerInfo.executionGroupName.buffer       = 
    (CciChar*)malloc (brokerInfo.executionGroupName.bufferLength * sizeof(CciChar));

  brokerInfo.queueManagerName.bufferLength = 
    brokerInfo.queueManagerName.dataLength;
  brokerInfo.queueManagerName.buffer       = 
    (CciChar*)malloc (brokerInfo.queueManagerName.bufferLength * sizeof(CciChar)); 

  cciGetBrokerInfo(&rc,&brokerInfo);

  /*ora eseguire operazioni sensate con tali stringhe prima che i buffer escano dall'ambito*/
  /* ad esempio, chiamare una funzione scritta da un utente per copiarle altrove*/
  copyBrokerInfo(brokerInfo.brokerName.buffer,
                 brokerInfo.executionGroupName.buffer,
                 brokerInfo.queueManagerName.buffer);

  free((void*)brokerInfo.brokerName.buffer);
  free((void*)brokerInfo.executionGroupName.buffer);
  free((void*)brokerInfo.queueManagerName.buffer);

}else{
  /*ora eseguire operazioni sensate con tali stringhe prima che i buffer escano dall'ambito*/
  /* ad esempio, chiamare una funzione scritta da un utente per copiarle altrove*/
  copyBrokerInfo(brokerInfo.brokerName.buffer,
                 brokerInfo.executionGroupName.buffer,
                 brokerInfo.queueManagerName.buffer);
}
Concetti correlati
Sviluppo di uscite utente
Attività correlate
Sviluppo di un'uscita utente
Informazioni particolari | Marchi | Download | Libreria | Supporto | Commenti
Copyright IBM Corporation 1999, 2006 Ultimo aggiornamento: ago 17, 2006
as36040_