Search in sources :

Example 1 with MessagingException

use of org.gytheio.messaging.MessagingException in project alfresco-repository by Alfresco.

the class ExceptionEventsServiceImpl method exceptionGenerated.

@Override
public void exceptionGenerated(String txnId, Throwable t) {
    if (enabled) {
        try {
            long timestamp = System.currentTimeMillis();
            String networkId = TenantUtil.getCurrentDomain();
            String username = AuthenticationUtil.getFullyAuthenticatedUser();
            ExceptionGeneratedEvent event = new ExceptionGeneratedEvent(nextSequenceNumber(), txnId, timestamp, networkId, t, username);
            messageProducer.send(event);
        } catch (MessagingException e) {
            logger.error(e);
        }
    }
}
Also used : MessagingException(org.gytheio.messaging.MessagingException) ExceptionGeneratedEvent(org.alfresco.sync.events.types.ExceptionGeneratedEvent)

Example 2 with MessagingException

use of org.gytheio.messaging.MessagingException in project alfresco-repository by Alfresco.

the class AbstractEventsService method afterRollback.

@Override
public void afterRollback() {
    String txnId = AlfrescoTransactionSupport.getTransactionId();
    long timestamp = System.currentTimeMillis();
    String networkId = TenantUtil.getCurrentDomain();
    String username = AuthenticationUtil.getFullyAuthenticatedUser();
    Client alfrescoClient = getAlfrescoClient(null);
    Event event = new TransactionRolledBackEvent(nextSequenceNumber(), txnId, networkId, timestamp, username, alfrescoClient);
    if (logger.isDebugEnabled()) {
        logger.debug("sendEvent " + event);
    }
    try {
        messageProducer.send(event);
    } catch (MessagingException e) {
        // throw new AlfrescoRuntimeException("Failed to send event", e);
        // TODO just log for now. How to deal with no running ActiveMQ?
        logger.error("Failed to send event " + event, e);
    } finally {
        TxnEvents events = (TxnEvents) AlfrescoTransactionSupport.getResource(EVENTS_KEY);
        if (events != null) {
            events.clear();
        }
    }
}
Also used : MessagingException(org.gytheio.messaging.MessagingException) TransactionRolledBackEvent(org.alfresco.sync.events.types.TransactionRolledBackEvent) Event(org.alfresco.sync.events.types.Event) TransactionCommittedEvent(org.alfresco.sync.events.types.TransactionCommittedEvent) Client(org.alfresco.sync.repo.Client) TransactionRolledBackEvent(org.alfresco.sync.events.types.TransactionRolledBackEvent)

Aggregations

MessagingException (org.gytheio.messaging.MessagingException)2 Event (org.alfresco.sync.events.types.Event)1 ExceptionGeneratedEvent (org.alfresco.sync.events.types.ExceptionGeneratedEvent)1 TransactionCommittedEvent (org.alfresco.sync.events.types.TransactionCommittedEvent)1 TransactionRolledBackEvent (org.alfresco.sync.events.types.TransactionRolledBackEvent)1 Client (org.alfresco.sync.repo.Client)1