-
1. Re: Additional management API about prepared transaction
igarashitm May 1, 2010 7:53 PM (in response to igarashitm)I'm trying to find how to access the message contents(ex. payload) which is under prepared transaction from Xid, but it has not been found yet, except reading all journal record from beginning. Is there any other way ?
Would you give me some advice ?
I'll read Compactor implementation which may have some hints.
----
Thanks
igarashitm
-
2. Re: Additional management API about prepared transaction
igarashitm Jun 1, 2010 3:29 AM (in response to igarashitm)I found PostOfficeImpl$AddOperation and QueueImpl$RefsOperation had a list of related MessageReference, and TransactionImpl has its own list of related TransactionOperation. So we can reach the message contents which is related to the transaction from Xid, if we can touch that field. However, these are now private and we can't touch them without reflection API.
two solutions:
- Create getter on TransactionImpl and TransactionOperation interface
- List<TransactionOperation> org.hornetq.core.transaction.impl.TransactionImpl#getAllOperations()
- List<MessageReference> org.hornetq.core.transaction#getRelatedReferences()
- List<TransactionOperation> org.hornetq.core.transaction.impl.TransactionImpl#getAllOperations()
- Make AddOperation and RefsOperation classes public. And create getter on these two classes and TransactionImpl
- List<TransactionOperation> org.hornetq.core.transaction.impl.TransactionImpl#getAllOperations()
- List<MessageReference> org.hornetq.core.transaction.impl.operation.AddOperation#getRelatedReferences()
- List<MessageReference> org.hornetq.core.transaction.impl.operation.RefsOperation#getRelatedReferences()
- List<TransactionOperation> org.hornetq.core.transaction.impl.TransactionImpl#getAllOperations()
I think 2nd solution is better because other TransactionOperation classes may not have MessageReference. (ex. org.hornetq.core.postoffice.impl.DuplicateIDCacheImpl$AddDuplicateIDOperation)
Would you give me any suggestion? If you agree with 2nd solution, I'll raise a JIRA and attach a patch.
----
Thanks,
igarashitm
- Create getter on TransactionImpl and TransactionOperation interface
-
3. Re: Additional management API about prepared transaction
clebert.suconic Jun 2, 2010 11:24 AM (in response to igarashitm)What about adding a toString() on each TransactionOperation,
and you could add a methodon TransactionOperation to expose the MessageReferences. You would return null or empty for the cases where you don't have a reference (example: AddDuplicateID)
TransactionOperation is a public class, on this case you can keep the implementations as private.
-
4. Re: Additional management API about prepared transaction
igarashitm Jun 3, 2010 3:14 AM (in response to clebert.suconic)Hello Clebert,
Thanks for your advice!
I like implementing getter of MessageReference on TransactionOperation, because toString() should fix String expression.
I've raised a JIRA and attached a patch. I'm happy if you pull it to the HornetQ.
https://jira.jboss.org/browse/HORNETQ-405
Thanks,
igarashitm
-
5. Re: Additional management API about prepared transaction
clebert.suconic Jun 3, 2010 10:24 AM (in response to igarashitm)So far you have created the methods to expose the messages on their respective transactions.
Are you still creating the method helpers on management to print the transaction detailed? Such as listTransactionDetailsAsHTML and listTransactionDetailsMaybe on HornetQServerControl?
If you do that, then the task willl be complete.
I believe you need something like that:
HornetQServerControl::listTransactionDetails(String XIDrepresentation)
Transaction tx = findTXSomehow(....); // the other methods are doing that
for (Operation operation: tx.getOperation())
{
outputString.println(operation.toString());
for (MessagRef ref: messagesOnTx)
{
/// print some info about the message.
}
}
-
6. Re: Additional management API about prepared transaction
igarashitm Jun 3, 2010 10:34 PM (in response to clebert.suconic)Hello Clebert,
oops, forgot to mention about that...Thanks for your suggestion.
OK, I'll implement the listTransactionDetailsAsHTML() and listTransactionDetails() and re-attach a patch including getter method(I attached last day).
-
7. Re: Additional management API about prepared transaction
clebert.suconic Jun 3, 2010 11:16 PM (in response to igarashitm)It would be nice to have some unit testing also. (At least to make sure the method won't fail). That's probably an easy one.
-
8. Re: Additional management API about prepared transaction
igarashitm Jun 16, 2010 3:41 AM (in response to clebert.suconic)Hello Clebert,
Sorry to be late. Attached new one.
https://jira.jboss.org/secure/attachment/12334997/listPreparedTransactionDetails.svndiff
----
- Add following operations to HornetQServerControl. Payload representation is *NOT* included in the output of these method.
- TranscationDetailDTO[] getPreparedTransactionDetails()
- String[] listPreparedTransactionDetails()
- String listPreparedTransactionDetailsAsHTML()
- And also add following operations to JMSServerControl. The output includes payload representation.
- String[] listPreparedTransactionDetails()
- String listPreparedTransactionDetailsAsHTML()
- Add some testcases
----
Could you consider to merge this into HornetQ?
- Add following operations to HornetQServerControl. Payload representation is *NOT* included in the output of these method.