If I run from command line (Windows):
artemis producer --message-count 1 --user xxx --password yyy --data /path/to/file
I get this error:
Error occurred during import. Rolling back.
java.util.NoSuchElementException: END_DOCUMENT reached: no more elements on the stream.
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:593)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.nextTag(XMLStreamReaderImpl.java:1346)
at org.apache.activemq.artemis.cli.factory.serialize.XMLMessageSerializer.read(XMLMessageSerializer.java:52)
at org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:175)
at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:212)
at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:162)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:144)
at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:61)
With --message I have no problem
Using
--datadoesn't send the specified file as an individual message. It reads the data in the file and potentially serializes it into multiple messages. However, in order to serialize the messages from the specified file you either need to provide your own implementation oforg.apache.activemq.artemis.cli.factory.serialize.MessageSerializer(via the--serializeroption) or use the default XML-based implementation (i.e.org.apache.activemq.artemis.cli.factory.serialize.XMLMessageSerializer) which uses a format like this:You are receiving an error because you're using the default XML-based serializer but your file is not the right format.