Thingol,
eu consegui mandar o parametro de identificação para a fila, mas não estou conseguindo obter a fila de acordo com aquele parametro.
Olha meu codig para enfileirar
[code] public void enfileirarTeste(AQSession aq_sess, String xml, String nomeFila, String nomeParametro, String valorParametro) throws AQException , JMSException
{
db_conn = ((AQOracleSession)aq_sess).getDBConnection();
/* Get a handle to queue table - aq_table4 in aqjava schema: */
q_table = aq_sess.getQueueTable (SCHEMA_TABLE_QUEUE, NOME_QUEUE_TABLE);
System.out.println("Successful getQueueTable");
/* Get a handle to a queue - aq_queue4 in aquser schema: */
queue = aq_sess.getQueue (SCHEMA_TABLE_QUEUE, nomeFila);
System.out.println("Successful getQueue");
[b]AQAgent agente = new AQAgent(nomeParametro, valorParametro);
AQMessageProperty prop = new AQMessageProperty();
prop.setSender(agente);
/* Creating a message to contain raw payload: */
message = queue.createMessage();
message.setMessageProperty(prop);[/b]
/* Get handle to the AQRawPayload object and populate it with raw data: */
b_array = xml.getBytes();
//b_array = (byte[])xml;
raw_payload = message.getRawPayload();
raw_payload.setStream(b_array, b_array.length);
/* Creating a AQEnqueueOption object with default options: */
enq_option = new AQEnqueueOption();
/* Enqueue the message: */
queue.enqueue(enq_option, message);
}[/code]
repare a parte negritada, eh onde eu coloquei os parametros. E no banco, ele aparece no campo SENDER NAME: o nome do parametro que mandei, e em SENDER ADDRESS aparece o valor do parametro que eu mandei.
na hora de recuperar, o meu metodo eh esse:
[code] public String desinfileirar(AQSession aq_sess, String nomeFila) throws AQException
{
db_conn = ((AQOracleSession)aq_sess).getDBConnection();
/* Get a handle to queue table - aq_table4 in aqjava schema: */
q_table = aq_sess.getQueueTable (SCHEMA_TABLE_QUEUE, NOME_QUEUE_TABLE);
System.out.println("Successful getQueueTable");
/* Get a handle to a queue - aq_queue4 in aquser schema: */
queue = aq_sess.getQueue (SCHEMA_TABLE_QUEUE, nomeFila);
System.out.println("Successful getQueue");
/* Creating a AQDequeueOption object with default options: */
deq_option = new AQDequeueOption();
[u][b] deq_option.setConsumerName("nome");
deq_option.setCondition("nome");[/b][/u]
/* Dequeue a message: */
message = queue.dequeue(deq_option);
System.out.println("Successful dequeue ");
[b] if(message.getMessageProperty().getSender().getAddress().equals("javaCBA"))
{
System.out.println("achei a fila certa");
}[/b]
/* Retrieve raw data from the message: */
raw_payload = message.getRawPayload();
b_array = raw_payload.getBytes();
return new String(b_array);
}[/code]
Na condição que eu fiz, ele entra e consegue confirmar se a fila é a fila que eu quero obter, mas se tiver varias filas ele não sabe identificar isso.
Por exemplo, se tiver uma fila com o valor do parametro igual a JAVACBA, ele vai conseguir tratar corretamente a fila. Mas se não tiver, ou se a primeira não for esse valor, já da erro.
To colocando o codigo setConsumer (que ta em negrito e sublinhado), ele não acha a fila.
Preciso de ajuda :?