Hmm,
why exposing the internal structure of the Message that way? Wouldn't it be
better to have value composites for the
header(s) which in turn could have value composites for their fields. the same
for attachments. Otherwise I'd prefer a
real collection type (Header) instead of having a map there.
That brings me to the question. Why arent there keyed (role supporting)
associations in qi4j? So that I can have a
Person father = ...
Person mother = ...
Person child = ...
child.relatives().add("father",father)
child.relatives().add("mother",mother)
I don't know if the message store should send them automatically? Perhaps I'd
only like store a draft or a copy. I'd
also use the same message store (inbox) for the messages received.
Should there be a state property - draft, sending, sent, failed) property.
Michael
Rickard Öberg schrieb:
> Hey,
>
> I've begun doing a messaging spike based on Camel, but it's gonna make
> me age really fast... took me the better part of a day just to get it to
> send an email, and getting it to output messages to Log4j is something I
> still have not been able to do. Crazy shit.
>
> On the one hand it would be nice to not have to do all the transports
> that they've integrated, but on the other hand so far it is relly
> frustrating to get it to work, and it brings in the entire Spring and
> JAXB dependencies really fast.
>
> All this being said, I have been able to create a MessageComposite which
> holds Message state like this:
> public interface MessageComposite
> extends EntityComposite
> {
> Property<String> messageId();
> Property<Map<String, Object>> headers();
> Property<Map<String, DataHandler>> attachments();
> Property<Object> body();
> }
>
> Sending a Message is done like so:
> UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
> try
> {
> EntityBuilder<MessageComposite> builder =
> unitOfWork.newEntityBuilder( MessageComposite.class );
>
> MessageComposite messageComposite = builder.newInstance();
> messageComposite.body().set("Hello World");
> Map<String, Object> headers = new HashMap<String, Object>( );
> headers.put( "to", "[EMAIL PROTECTED]" );
> headers.put( "subject", "testing" );
> messageComposite.headers().set(headers);
>
> unitOfWork.complete();
> }
> catch( Exception e )
> {
> unitOfWork.discard();
> }
> ---
> I.e. create a MessageComposite Entity and go, so the basic idea seems
> ok. The EntityStore for messages has a concern that forwards them to
> Camel. Works, but with all the above grey-hair-producing crap along with it.
>
> So I'm not sure how to proceed really. Any thoughts?
>
> /Rickard
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev