Search in sources :

Example 6 with MessageSendingPipe

use of nl.nn.adapterframework.pipes.MessageSendingPipe in project iaf by ibissource.

the class Browse method executeSub.

public ActionForward executeSub(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    // Initialize action
    initAction(request);
    DynaActionForm browseForm = getPersistentForm(mapping, form, request);
    String submit = request.getParameter("submit");
    log.debug("submit param [" + submit + "]");
    String maxMessagesStr = getAndSetProperty(request, browseForm, "maxMessages", getMaxMessages() + "");
    String skipMessagesStr = getAndSetProperty(request, browseForm, "skipMessages", "0");
    String action = getAndSetProperty(request, browseForm, "action");
    String storageType = getAndSetProperty(request, browseForm, "storageType");
    String adapterName = getAndSetProperty(request, browseForm, "adapterName");
    String receiverName = getAndSetProperty(request, browseForm, "receiverName");
    String pipeName = getAndSetProperty(request, browseForm, "pipeName");
    String messageId = getAndSetProperty(request, browseForm, "messageId");
    String typeMask = getAndSetProperty(request, browseForm, "typeMask");
    String hostMask = getAndSetProperty(request, browseForm, "hostMask");
    String currentIdMask = getAndSetProperty(request, browseForm, "currentIdMask");
    String messageIdMask = getAndSetProperty(request, browseForm, "messageIdMask");
    String correlationIdMask = getAndSetProperty(request, browseForm, "correlationIdMask");
    String commentMask = getAndSetProperty(request, browseForm, "commentMask");
    String messageTextMask = getAndSetProperty(request, browseForm, "messageTextMask");
    String labelMask = getAndSetProperty(request, browseForm, "labelMask");
    String startDateStr = getAndSetProperty(request, browseForm, "insertedAfter");
    String startDateClipStr = getAndSetProperty(request, browseForm, "insertedAfterClip");
    // not yet supported in actionForm
    String endDateStr = request.getParameter("insertedBefore");
    // not yet supported in actionForm
    String forceDescStr = request.getParameter("forceDescending");
    String viewAs = getAndSetProperty(request, browseForm, "viewAs", request.getParameter("type"));
    String[] selected = (String[]) browseForm.get("selected");
    boolean startDateClip = "on".equals(startDateClipStr);
    if (StringUtils.isNotEmpty(submit)) {
        action = submit;
    }
    Date startDate = null;
    Date endDate = null;
    String formattedStartDate = null;
    if (StringUtils.isNotEmpty(startDateStr)) {
        try {
            startDate = DateUtils.parseAnyDate(startDateStr);
            if (startDate != null) {
                formattedStartDate = DateUtils.formatOptimal(startDate);
                log.debug("parsed start date to [" + formattedStartDate + "]");
                browseForm.set("insertedAfter", formattedStartDate);
                if (startDateClip) {
                    endDate = DateUtils.nextHigherValue(startDate);
                }
            } else {
                warn("could not parse date from [" + startDateStr + "]");
            }
        } catch (CalendarParserException e) {
            warn("could not parse date from [" + startDateStr + "]", e);
        }
    }
    if (StringUtils.isNotEmpty(endDateStr)) {
        try {
            endDate = DateUtils.parseAnyDate(endDateStr);
            if (startDate == null) {
                warn("could not parse date from [" + endDateStr + "]");
            }
        } catch (CalendarParserException e) {
            warn("could not parse date from [" + startDateStr + "]", e);
        }
    }
    ArrayList viewAsList = new ArrayList();
    viewAsList.add("html");
    viewAsList.add("text");
    browseForm.set("viewAsList", viewAsList);
    log.debug("selected [" + browseForm.get("selected") + "]");
    // ArrayList selected=(ArrayList)browseForm.get("selected");
    // for (int i=0; i<selected.size(); i++) {
    // log.debug("selected "+i+" = ["+selected.get(i));
    // }
    maxMessages = Integer.parseInt(maxMessagesStr);
    skipMessages = Integer.parseInt(skipMessagesStr);
    // commandIssuedBy containes information about the location the
    // command is sent from
    String commandIssuedBy = HttpUtils.getCommandIssuedBy(request);
    log.debug("storageType [" + storageType + "] action [" + action + "] submit [" + submit + "] adapterName [" + adapterName + "] receiverName [" + receiverName + "] pipeName [" + pipeName + "] issued by [" + commandIssuedBy + "]");
    Adapter adapter = (Adapter) ibisManager.getRegisteredAdapter(adapterName);
    IMessageBrowser mb;
    IListener listener = null;
    String logCount;
    if ("messagelog".equals(storageType)) {
        if (StringUtils.isNotEmpty(pipeName)) {
            MessageSendingPipe pipe = (MessageSendingPipe) adapter.getPipeLine().getPipe(pipeName);
            mb = pipe.getMessageLog();
        } else {
            ReceiverBase receiver = (ReceiverBase) adapter.getReceiverByName(receiverName);
            mb = receiver.getMessageLog();
        }
        // actions 'deletemessage' and 'resendmessage' not allowed for messageLog
        if ("export selected".equalsIgnoreCase(action)) {
            performAction(adapter, null, action, mb, messageId, selected, request, response);
        }
    } else {
        ReceiverBase receiver = (ReceiverBase) adapter.getReceiverByName(receiverName);
        if (receiver == null) {
            error("cannot find Receiver [" + receiverName + "]", null);
            return null;
        }
        mb = receiver.getErrorStorage();
        if (performAction(adapter, receiver, action, mb, messageId, selected, request, response))
            return null;
        listener = receiver.getListener();
    }
    try {
        logCount = "(" + ((ITransactionalStorage) mb).getMessageCount() + ")";
    } catch (Exception e) {
        log.warn(e);
        logCount = "(?)";
    }
    try {
        if ("showmessage".equalsIgnoreCase(action)) {
            Object rawmsg = mb.browseMessage(messageId);
            String msg = null;
            if (listener != null) {
                msg = listener.getStringFromRawMessage(rawmsg, null);
            } else {
                msg = (String) rawmsg;
            }
            if (StringUtils.isEmpty(msg)) {
                msg = "<no message found>";
            }
            String type = request.getParameter("type");
            if (StringUtils.isEmpty(type)) {
                type = viewAs;
            }
            FileViewerServlet.showReaderContents(new StringReader(msg), "msg" + messageId, type, response, "message [" + messageId + "]");
            return null;
        } else {
            IMessageBrowsingIterator mbi = mb.getIterator(startDate, endDate, "true".equals(forceDescStr));
            try {
                XmlBuilder messages = new XmlBuilder("messages");
                messages.addAttribute("storageType", storageType);
                messages.addAttribute("action", action);
                messages.addAttribute("adapterName", XmlUtils.encodeChars(adapterName));
                if ("messagelog".equals(storageType) && StringUtils.isNotEmpty(pipeName)) {
                    messages.addAttribute("object", "pipe [" + XmlUtils.encodeChars(pipeName) + "] of adapter [" + XmlUtils.encodeChars(adapterName) + "] " + logCount);
                    messages.addAttribute("pipeName", XmlUtils.encodeChars(pipeName));
                } else {
                    messages.addAttribute("object", "receiver [" + XmlUtils.encodeChars(receiverName) + "] of adapter [" + XmlUtils.encodeChars(adapterName) + "] " + logCount);
                    messages.addAttribute("receiverName", XmlUtils.encodeChars(receiverName));
                }
                int messageCount;
                for (messageCount = 0; mbi.hasNext(); ) {
                    IMessageBrowsingIteratorItem iterItem = mbi.next();
                    try {
                        String cType = iterItem.getType();
                        String cHost = iterItem.getHost();
                        String cId = iterItem.getId();
                        String cMessageId = iterItem.getOriginalId();
                        String cCorrelationId = iterItem.getCorrelationId();
                        String comment = iterItem.getCommentString();
                        Date insertDate = iterItem.getInsertDate();
                        String cLabel = iterItem.getLabel();
                        if (StringUtils.isNotEmpty(typeMask) && !cType.startsWith(typeMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(hostMask) && !cHost.startsWith(hostMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(currentIdMask) && !cId.startsWith(currentIdMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(messageIdMask) && !cMessageId.startsWith(messageIdMask)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(correlationIdMask) && !cCorrelationId.startsWith(correlationIdMask)) {
                            continue;
                        }
                        if (startDate != null && insertDate != null) {
                            if (insertDate.before(startDate)) {
                                continue;
                            }
                            if (startDateClip) {
                                String formattedInsertDate = DateUtils.formatOptimal(insertDate);
                                if (!formattedInsertDate.startsWith(formattedStartDate)) {
                                    continue;
                                }
                            }
                        }
                        if (StringUtils.isNotEmpty(commentMask) && (StringUtils.isEmpty(comment) || comment.indexOf(commentMask) < 0)) {
                            continue;
                        }
                        if (StringUtils.isNotEmpty(messageTextMask)) {
                            Object rawmsg = mb.browseMessage(cId);
                            String msg = null;
                            if (listener != null) {
                                msg = listener.getStringFromRawMessage(rawmsg, new HashMap());
                            } else {
                                msg = (String) rawmsg;
                            }
                            if (msg == null || msg.indexOf(messageTextMask) < 0) {
                                continue;
                            }
                        }
                        if (StringUtils.isNotEmpty(labelMask) && (StringUtils.isEmpty(cLabel) || !cLabel.startsWith(labelMask))) {
                            continue;
                        }
                        messageCount++;
                        if (messageCount > skipMessages) {
                            XmlBuilder message = new XmlBuilder("message");
                            message.addAttribute("id", cId);
                            message.addAttribute("pos", Integer.toString(messageCount));
                            message.addAttribute("originalId", cMessageId);
                            message.addAttribute("correlationId", cCorrelationId);
                            message.addAttribute("type", cType);
                            message.addAttribute("host", cHost);
                            message.addAttribute("insertDate", DateUtils.format(insertDate, DateUtils.FORMAT_FULL_GENERIC));
                            if (iterItem.getExpiryDate() != null) {
                                message.addAttribute("expiryDate", DateUtils.format(iterItem.getExpiryDate(), DateUtils.FORMAT_FULL_GENERIC));
                            }
                            message.addAttribute("comment", XmlUtils.encodeChars(iterItem.getCommentString()));
                            message.addAttribute("label", cLabel);
                            messages.addSubElement(message);
                        }
                        if (getMaxMessages() > 0 && messageCount >= (getMaxMessages() + skipMessages)) {
                            log.warn("stopped iterating messages after [" + messageCount + "]: limit reached");
                            break;
                        }
                    } finally {
                        iterItem.release();
                    }
                }
                messages.addAttribute("messageCount", Integer.toString(messageCount - skipMessages));
                request.setAttribute("messages", messages.toXML());
            } finally {
                mbi.close();
            }
        }
    } catch (Throwable e) {
        error("Caught Exception", e);
        throw new ServletException(e);
    }
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
    }
    log.debug("forward to success");
    return (mapping.findForward("success"));
}
Also used : ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) DynaActionForm(org.apache.struts.action.DynaActionForm) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) HashMap(java.util.HashMap) IMessageBrowsingIteratorItem(nl.nn.adapterframework.core.IMessageBrowsingIteratorItem) IMessageBrowser(nl.nn.adapterframework.core.IMessageBrowser) IListener(nl.nn.adapterframework.core.IListener) ArrayList(java.util.ArrayList) Adapter(nl.nn.adapterframework.core.Adapter) IMessageBrowsingIterator(nl.nn.adapterframework.core.IMessageBrowsingIterator) Date(java.util.Date) ServletException(javax.servlet.ServletException) CalendarParserException(nl.nn.adapterframework.util.CalendarParserException) IOException(java.io.IOException) CalendarParserException(nl.nn.adapterframework.util.CalendarParserException) ServletException(javax.servlet.ServletException) StringReader(java.io.StringReader) XmlBuilder(nl.nn.adapterframework.util.XmlBuilder)

Example 7 with MessageSendingPipe

use of nl.nn.adapterframework.pipes.MessageSendingPipe in project iaf by ibissource.

the class PipeLine method configure.

public void configure(IPipe pipe) throws ConfigurationException {
    try {
        if (pipe instanceof IExtendedPipe) {
            IExtendedPipe epipe = (IExtendedPipe) pipe;
            epipe.configure(this);
            if (epipe.getDurationThreshold() >= 0) {
                epipe.registerEvent(IExtendedPipe.LONG_DURATION_MONITORING_EVENT);
            }
            epipe.registerEvent(IExtendedPipe.PIPE_EXCEPTION_MONITORING_EVENT);
            if (getMessageSizeWarnNum() >= 0) {
                epipe.registerEvent(IExtendedPipe.MESSAGE_SIZE_MONITORING_EVENT);
            }
            if (epipe.hasSizeStatistics()) {
                if (pipe instanceof AbstractPipe) {
                    AbstractPipe aPipe = (AbstractPipe) pipe;
                    if (aPipe.getInSizeStatDummyObject() != null) {
                        pipeSizeStats.put(aPipe.getInSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getInSizeStatDummyObject().getName()));
                    }
                    if (aPipe.getOutSizeStatDummyObject() != null) {
                        pipeSizeStats.put(aPipe.getOutSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getOutSizeStatDummyObject().getName()));
                    }
                } else {
                    pipeSizeStats.put(pipe.getName(), new SizeStatisticsKeeper(pipe.getName()));
                }
            }
        } else {
            pipe.configure();
        }
        if (pipe instanceof MessageSendingPipe) {
            MessageSendingPipe messageSendingPipe = (MessageSendingPipe) pipe;
            if (messageSendingPipe.getInputValidator() != null) {
                configure(messageSendingPipe.getInputValidator());
            }
            if (messageSendingPipe.getOutputValidator() != null) {
                configure(messageSendingPipe.getOutputValidator());
            }
            if (messageSendingPipe.getInputWrapper() != null) {
                configure(messageSendingPipe.getInputWrapper());
            }
            if (messageSendingPipe.getOutputWrapper() != null) {
                configure(messageSendingPipe.getOutputWrapper());
            }
            if (messageSendingPipe.getMessageLog() != null) {
                pipeStatistics.put(messageSendingPipe.getMessageLog().getName(), new StatisticsKeeper(messageSendingPipe.getMessageLog().getName()));
            }
        }
        pipeStatistics.put(pipe.getName(), new StatisticsKeeper(pipe.getName()));
    // congestionSensors.addSensor(pipe);
    } catch (Throwable t) {
        if (t instanceof ConfigurationException) {
            throw (ConfigurationException) t;
        }
        throw new ConfigurationException("Exception configuring Pipe [" + pipe.getName() + "]", t);
    }
    if (log.isDebugEnabled()) {
        log.debug("Pipeline of [" + owner.getName() + "]: Pipe [" + pipe.getName() + "] successfully configured: [" + pipe.toString() + "]");
    }
}
Also used : AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) StatisticsKeeper(nl.nn.adapterframework.statistics.StatisticsKeeper)

Example 8 with MessageSendingPipe

use of nl.nn.adapterframework.pipes.MessageSendingPipe in project iaf by ibissource.

the class PipeLine method iterateOverStatistics.

@Override
public void iterateOverStatistics(StatisticsKeeperIterationHandler hski, Object data, int action) throws SenderException {
    Object pipeStatsData = hski.openGroup(data, null, "pipeStats");
    handlePipeStat(getInputValidator(), pipeStatistics, pipeStatsData, hski, true, action);
    handlePipeStat(getOutputValidator(), pipeStatistics, pipeStatsData, hski, true, action);
    handlePipeStat(getInputWrapper(), pipeStatistics, pipeStatsData, hski, true, action);
    handlePipeStat(getOutputWrapper(), pipeStatistics, pipeStatsData, hski, true, action);
    for (IPipe pipe : adapter.getPipeLine().getPipes()) {
        handlePipeStat(pipe, pipeStatistics, pipeStatsData, hski, true, action);
        if (pipe instanceof MessageSendingPipe) {
            MessageSendingPipe messageSendingPipe = (MessageSendingPipe) pipe;
            if (messageSendingPipe.getInputValidator() != null) {
                handlePipeStat(messageSendingPipe.getInputValidator(), pipeStatistics, pipeStatsData, hski, true, action);
            }
            if (messageSendingPipe.getOutputValidator() != null) {
                handlePipeStat(messageSendingPipe.getOutputValidator(), pipeStatistics, pipeStatsData, hski, true, action);
            }
            if (messageSendingPipe.getInputWrapper() != null) {
                handlePipeStat(messageSendingPipe.getInputWrapper(), pipeStatistics, pipeStatsData, hski, true, action);
            }
            if (messageSendingPipe.getOutputWrapper() != null) {
                handlePipeStat(messageSendingPipe.getOutputWrapper(), pipeStatistics, pipeStatsData, hski, true, action);
            }
            if (messageSendingPipe.getMessageLog() != null) {
                handlePipeStat(messageSendingPipe.getMessageLog(), pipeStatistics, pipeStatsData, hski, true, action);
            }
        }
    }
    if (pipeWaitingStatistics.size() > 0) {
        Object waitStatsData = hski.openGroup(data, null, "waitStats");
        for (IPipe pipe : adapter.getPipeLine().getPipes()) {
            handlePipeStat(pipe, pipeWaitingStatistics, waitStatsData, hski, false, action);
        }
    }
    hski.closeGroup(pipeStatsData);
    Object sizeStatsData = hski.openGroup(data, null, "sizeStats");
    hski.handleStatisticsKeeper(sizeStatsData, getRequestSizeStats());
    for (IPipe pipe : adapter.getPipeLine().getPipes()) {
        if (pipe instanceof AbstractPipe) {
            AbstractPipe aPipe = (AbstractPipe) pipe;
            if (aPipe.getInSizeStatDummyObject() != null) {
                handlePipeStat(aPipe.getInSizeStatDummyObject(), pipeSizeStats, sizeStatsData, hski, false, action);
            }
            if (aPipe.getOutSizeStatDummyObject() != null) {
                handlePipeStat(aPipe.getOutSizeStatDummyObject(), pipeSizeStats, sizeStatsData, hski, false, action);
            }
        } else {
            handlePipeStat(pipe, pipeSizeStats, sizeStatsData, hski, false, action);
        }
    }
    hski.closeGroup(sizeStatsData);
}
Also used : AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe)

Example 9 with MessageSendingPipe

use of nl.nn.adapterframework.pipes.MessageSendingPipe in project iaf by ibissource.

the class ListenerFactory method copyAttrsToMap.

@Override
protected Map copyAttrsToMap(Attributes attrs) {
    Map map = super.copyAttrsToMap(attrs);
    String className = attrs.getValue("className");
    if (className != null && getDigester().peek() instanceof MessageSendingPipe && className.endsWith(JMS_LISTENER_CLASSNAME_SUFFIX)) {
        if (log.isDebugEnabled()) {
            log.debug("JmsListener is created as part of a MessageSendingPipe; replace classname with '" + CORRELATED_LISTENER_CLASSNAME + "' to ensure compatibility");
        }
        map.put("className", CORRELATED_LISTENER_CLASSNAME);
    }
    return map;
}
Also used : MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) Map(java.util.Map)

Example 10 with MessageSendingPipe

use of nl.nn.adapterframework.pipes.MessageSendingPipe in project iaf by ibissource.

the class JobDef method cleanupDatabase.

private void cleanupDatabase(IbisManager ibisManager) {
    Date date = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String formattedDate = formatter.format(date);
    List<String> jmsRealmNames = new ArrayList<String>();
    for (Configuration configuration : ibisManager.getConfigurations()) {
        List<JobDef> scheduledJobs = configuration.getScheduledJobs();
        for (JobDef jobdef : configuration.getScheduledJobs()) {
            if (jobdef.getLocker() != null) {
                String jmsRealmName = jobdef.getLocker().getJmsRealName();
                if (!jmsRealmNames.contains(jmsRealmName)) {
                    jmsRealmNames.add(jmsRealmName);
                }
            }
        }
    }
    for (IAdapter adapter : ibisManager.getRegisteredAdapters()) {
        if (adapter instanceof Adapter) {
            PipeLine pipeLine = ((Adapter) adapter).getPipeLine();
            if (pipeLine != null) {
                for (IPipe pipe : pipeLine.getPipes()) {
                    if (pipe instanceof IExtendedPipe) {
                        IExtendedPipe extendedPipe = (IExtendedPipe) pipe;
                        if (extendedPipe.getLocker() != null) {
                            String jmsRealmName = extendedPipe.getLocker().getJmsRealName();
                            if (!jmsRealmNames.contains(jmsRealmName)) {
                                jmsRealmNames.add(jmsRealmName);
                            }
                        }
                    }
                }
            }
        }
    }
    for (Iterator iter = jmsRealmNames.iterator(); iter.hasNext(); ) {
        String jmsRealmName = (String) iter.next();
        setJmsRealm(jmsRealmName);
        DirectQuerySender qs;
        qs = (DirectQuerySender) ibisManager.getIbisContext().createBeanAutowireByName(DirectQuerySender.class);
        qs.setJmsRealm(jmsRealmName);
        String deleteQuery;
        if (qs.getDatabaseType() == DbmsSupportFactory.DBMS_MSSQLSERVER) {
            deleteQuery = "DELETE FROM IBISLOCK WHERE EXPIRYDATE < CONVERT(datetime, '" + formattedDate + "', 120)";
        } else {
            deleteQuery = "DELETE FROM IBISLOCK WHERE EXPIRYDATE < TO_TIMESTAMP('" + formattedDate + "', 'YYYY-MM-DD HH24:MI:SS')";
        }
        setQuery(deleteQuery);
        qs = null;
        executeQueryJob(ibisManager);
    }
    List messageLogs = new ArrayList();
    for (IAdapter iadapter : ibisManager.getRegisteredAdapters()) {
        Adapter adapter = (Adapter) iadapter;
        PipeLine pipeline = adapter.getPipeLine();
        for (int i = 0; i < pipeline.getPipes().size(); i++) {
            IPipe pipe = pipeline.getPipe(i);
            if (pipe instanceof MessageSendingPipe) {
                MessageSendingPipe msp = (MessageSendingPipe) pipe;
                if (msp.getMessageLog() != null) {
                    ITransactionalStorage transactionStorage = msp.getMessageLog();
                    if (transactionStorage instanceof JdbcTransactionalStorage) {
                        JdbcTransactionalStorage messageLog = (JdbcTransactionalStorage) transactionStorage;
                        String jmsRealmName = messageLog.getJmsRealName();
                        String expiryDateField = messageLog.getExpiryDateField();
                        String tableName = messageLog.getTableName();
                        String keyField = messageLog.getKeyField();
                        String typeField = messageLog.getTypeField();
                        MessageLogObject mlo = new MessageLogObject(jmsRealmName, tableName, expiryDateField, keyField, typeField);
                        if (!messageLogs.contains(mlo)) {
                            messageLogs.add(mlo);
                        }
                    }
                }
            }
        }
    }
    for (Iterator iter = messageLogs.iterator(); iter.hasNext(); ) {
        MessageLogObject mlo = (MessageLogObject) iter.next();
        setJmsRealm(mlo.getJmsRealmName());
        DirectQuerySender qs;
        qs = (DirectQuerySender) ibisManager.getIbisContext().createBeanAutowireByName(DirectQuerySender.class);
        qs.setJmsRealm(mlo.getJmsRealmName());
        String deleteQuery;
        if (qs.getDatabaseType() == DbmsSupportFactory.DBMS_MSSQLSERVER) {
            deleteQuery = "DELETE FROM " + mlo.getTableName() + " WHERE " + mlo.getKeyField() + " IN (SELECT " + mlo.getKeyField() + " FROM " + mlo.getTableName() + " WITH (rowlock,updlock,readpast) WHERE " + mlo.getTypeField() + " IN ('" + JdbcTransactionalStorage.TYPE_MESSAGELOG_PIPE + "','" + JdbcTransactionalStorage.TYPE_MESSAGELOG_RECEIVER + "') AND " + mlo.getExpiryDateField() + " < CONVERT(datetime, '" + formattedDate + "', 120))";
        } else {
            deleteQuery = "DELETE FROM " + mlo.getTableName() + " WHERE " + mlo.getTypeField() + " IN ('" + JdbcTransactionalStorage.TYPE_MESSAGELOG_PIPE + "','" + JdbcTransactionalStorage.TYPE_MESSAGELOG_RECEIVER + "') AND " + mlo.getExpiryDateField() + " < TO_TIMESTAMP('" + formattedDate + "', 'YYYY-MM-DD HH24:MI:SS')";
        }
        qs = null;
        setQuery(deleteQuery);
        setQueryTimeout(900);
        executeQueryJob(ibisManager);
    }
}
Also used : Configuration(nl.nn.adapterframework.configuration.Configuration) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) ArrayList(java.util.ArrayList) DirectQuerySender(nl.nn.adapterframework.jdbc.DirectQuerySender) Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) Date(java.util.Date) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage) JdbcTransactionalStorage(nl.nn.adapterframework.jdbc.JdbcTransactionalStorage) Iterator(java.util.Iterator) IExtendedPipe(nl.nn.adapterframework.core.IExtendedPipe) ArrayList(java.util.ArrayList) List(java.util.List) PipeLine(nl.nn.adapterframework.core.PipeLine) SimpleDateFormat(java.text.SimpleDateFormat) IAdapter(nl.nn.adapterframework.core.IAdapter) IPipe(nl.nn.adapterframework.core.IPipe)

Aggregations

MessageSendingPipe (nl.nn.adapterframework.pipes.MessageSendingPipe)10 IPipe (nl.nn.adapterframework.core.IPipe)6 PipeLine (nl.nn.adapterframework.core.PipeLine)6 Adapter (nl.nn.adapterframework.core.Adapter)5 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)5 IAdapter (nl.nn.adapterframework.core.IAdapter)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 IListener (nl.nn.adapterframework.core.IListener)3 ISender (nl.nn.adapterframework.core.ISender)3 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)3 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)3 IOException (java.io.IOException)2 Date (java.util.Date)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 ServletException (javax.servlet.ServletException)2 HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)2 FtpSender (nl.nn.adapterframework.ftp.FtpSender)2