use of com.helger.as2lib.processor.DefaultMessageProcessor in project as2-lib by phax.
the class AS2ReceiveXServletHandlerCodeConfig method createAS2Session.
@Override
@Nonnull
protected AS2Session createAS2Session(@Nonnull final ICommonsMap<String, String> aInitParams) throws AS2Exception, ServletException {
final AS2Session aSession = new AS2Session();
{
// Create CertificateFactory
final CertificateFactory aCertFactory = new CertificateFactory();
aCertFactory.setKeyStoreType(EKeyStoreType.PKCS12);
aCertFactory.setFilename("clientCertificate.jks");
aCertFactory.setPassword("test1234");
aCertFactory.setSaveChangesToFile(false);
aCertFactory.initDynamicComponent(aSession, null);
aSession.setCertificateFactory(aCertFactory);
}
{
// Create PartnershipFactory
final SelfFillingPartnershipFactory aPartnershipFactory = new SelfFillingPartnershipFactory();
aPartnershipFactory.initDynamicComponent(aSession, null);
aSession.setPartnershipFactory(aPartnershipFactory);
}
{
// Create MessageProcessor
final DefaultMessageProcessor aMessageProcessor = new DefaultMessageProcessor();
aMessageProcessor.setPendingMDNFolder("data/pendingMDN");
aMessageProcessor.setPendingMDNInfoFolder("data/pendinginfoMDN");
aMessageProcessor.initDynamicComponent(aSession, null);
aSession.setMessageProcessor(aMessageProcessor);
/**
* Required to receive messages port is required internally - simply
* ignore it for servlets
*/
{
final AS2ServletReceiverModule aModule = new AS2ServletReceiverModule();
aModule.setErrorDirectory("data/inbox/error");
aModule.setErrorFormat("$msg.sender.as2_id$, $msg.receiver.as2_id$, $msg.headers.message-id$");
aModule.initDynamicComponent(aSession, null);
aMessageProcessor.addModule(aModule);
}
/**
* Only needed to receive asynchronous MDNs
*/
{
final AS2ServletMDNReceiverModule aModule = new AS2ServletMDNReceiverModule();
aModule.initDynamicComponent(aSession, null);
aMessageProcessor.addModule(aModule);
}
/**
* Below module is used to send async mdn
*/
{
final AsynchMDNSenderModule aModule = new AsynchMDNSenderModule();
aModule.initDynamicComponent(aSession, null);
aMessageProcessor.addModule(aModule);
}
/**
* A module storing the message.
*/
{
final MyHandlerModule aModule = new MyHandlerModule();
aModule.initDynamicComponent(aSession, null);
aMessageProcessor.addModule(aModule);
}
// Add further modules if you need them
}
return aSession;
}
use of com.helger.as2lib.processor.DefaultMessageProcessor in project as2-lib by phax.
the class AS2Client method initMessageProcessor.
/**
* Init the message processor. If you override this method, please make sure
* that you call
* <code>aSession.setMessageProcessor (aMessageProcessor);</code>.
*
* @param aSession
* The AS2 session to be filled. Never <code>null</code>.
* @throws AS2Exception
* In case of error
*/
@OverrideOnDemand
protected void initMessageProcessor(@Nonnull final AS2Session aSession) throws AS2Exception {
final IMessageProcessor aMessageProcessor = new DefaultMessageProcessor();
aMessageProcessor.initDynamicComponent(aSession, null);
aSession.setMessageProcessor(aMessageProcessor);
}
Aggregations