Package org.axonframework.eventstore

Examples of org.axonframework.eventstore.EventStoreException


            this.statement = statement;
            try {
                ResultSet resultSet = statement.executeQuery();
                rsIterator = new ResultSetIterator<T>(resultSet, sqlSchema);
            } catch (SQLException e) {
                throw new EventStoreException("Exception occurred while attempting to execute query on statement", e);
            }
        }
View Full Code Here


        public boolean hasNext() {
            try {
                establishNext();
                return hasNext;
            } catch (SQLException e) {
                throw new EventStoreException("Exception occurred while attempting to fetch data from ResultSet", e);
            }
        }
View Full Code Here

                if (hasNext) {
                    counter++;
                }
                return sqlSchema.createSerializedDomainEventData(rs);
            } catch (SQLException e) {
                throw new EventStoreException("Exception occurred while attempting to read next event from ResultSet",
                                              e);
            } finally {
                hasCalledNext = false;
            }
        }
View Full Code Here

                } else {
                    next = null;
                }
            } while (next != null);
        } catch (IOException e) {
            throw new EventStoreException("Unable to store given entity due to an IOException", e);
        } finally {
            IOUtils.closeQuietly(out);
        }
    }
View Full Code Here

                is = new SequenceInputStream(new ByteArrayInputStream(baos.toByteArray()), eventFileInputStream);
            }

            return new FileSystemBufferedReaderDomainEventStream(is, eventSerializer, upcasterChain);
        } catch (IOException e) {
            throw new EventStoreException(
                    String.format("An error occurred while trying to open the event file "
                                          + "for aggregate type [%s] with identifier [%s]",
                                  type, aggregateIdentifier), e);
        }
    }
View Full Code Here

            FileSystemSnapshotEventWriter snapshotEventWriter =
                    new FileSystemSnapshotEventWriter(eventFile, snapshotEventFile, eventSerializer);

            snapshotEventWriter.writeSnapshotEvent(snapshotEvent);
        } catch (IOException e) {
            throw new EventStoreException("Error writing a snapshot event due to an IO exception", e);
        } finally {
            IOUtils.closeQuietly(eventFile);
        }
    }
View Full Code Here

            return upcastEvents;
        } catch (EOFException e) {
            // No more events available
            return Collections.emptyList();
        } catch (IOException e) {
            throw new EventStoreException("An error occurred while reading from the underlying source", e);
        }
    }
View Full Code Here

    private File getBaseDirForType(String type) {

        File typeSpecificDir = new File(baseDir, type);
        if (!typeSpecificDir.exists() && !typeSpecificDir.mkdirs() && !typeSpecificDir.exists()) {
            throw new EventStoreException("The given event store directory doesn't exist and could not be created");
        }
        return typeSpecificDir;
    }
View Full Code Here

                DomainEventMessage next = events.next();
                validateIdentifier(next.getAggregateIdentifier().getClass());
                if (!storedEvents.isEmpty()) {
                    DomainEventMessage lastEvent = storedEvents.peekLast();
                    if (!lastEvent.getAggregateIdentifier().equals(next.getAggregateIdentifier())) {
                        throw new EventStoreException("Writing events for an unexpected aggregate. This could "
                                                              + "indicate that a wrong aggregate is being triggered.");
                    } else if (lastEvent.getSequenceNumber() != next.getSequenceNumber() - 1) {
                        throw new EventStoreException(format("Unexpected sequence number on stored event. "
                                                                     + "Expected %s, but got %s.",
                                                             lastEvent.getSequenceNumber() + 1,
                                                             next.getSequenceNumber()));
                    }
                }
View Full Code Here

        public DomainEventStream readEvents(String type, Object identifier) {
            if (identifier != null) {
                validateIdentifier(identifier.getClass());
            }
            if (aggregateIdentifier != null && !aggregateIdentifier.equals(identifier)) {
                throw new EventStoreException("You probably want to use aggregateIdentifier() on your fixture "
                                                      + "to get the aggregate identifier to use");
            } else if (aggregateIdentifier == null) {
                aggregateIdentifier = identifier;
                injectAggregateIdentifier();
            }
View Full Code Here

TOP

Related Classes of org.axonframework.eventstore.EventStoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.