<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lee Conlin on Medium]]></title>
        <description><![CDATA[Stories by Lee Conlin on Medium]]></description>
        <link>https://medium.com/@lee.conlin?source=rss-e6e979142015------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*IXvI9Tz4ym8_QgX_.jpg</url>
            <title>Stories by Lee Conlin on Medium</title>
            <link>https://medium.com/@lee.conlin?source=rss-e6e979142015------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 15:37:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lee.conlin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Agile in an agency]]></title>
            <link>https://medium.com/@lee.conlin/agile-in-an-agency-b31210d377ed?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/b31210d377ed</guid>
            <category><![CDATA[agile-transformation]]></category>
            <category><![CDATA[agencylife]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[agile-development]]></category>
            <category><![CDATA[agency]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Mon, 26 Jul 2021 08:14:57 GMT</pubDate>
            <atom:updated>2021-07-26T08:47:10.634Z</atom:updated>
            <content:encoded><![CDATA[<p>In my time working in an agency, I’ve seen a lot of projects and a lot of discussion around how best to plan and run various projects in the agency environment. Distinction’s 2020 brand repositioning to the <a href="https://distinction.co.uk/journal/why-active-strategy-is-the-answer-to-2020s-questions">strategy agency that’s all about the action</a> led to some interesting discussions and changes in the way we think about and plan for projects.</p><p>It’s been clear for over two decades now that the old way of planning and managing projects, known as the <a href="https://en.wikipedia.org/wiki/Waterfall_model">Waterfall methodology</a>, just doesn’t cut it in today’s world of high-speed change. The COVID-19 pandemic and the changes that came with it (and continue to come) show us, beyond a doubt, that even the best-laid plans are meaningless in the face of a world that changes so rapidly from one day to the next.</p><p>So why do agencies continue to present rigid, up-front plans to clients? Why do clients continue to insist on having a contracted scope and budget for their project up-front?</p><h3>Time and Money</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lYzcg0HdMg4hU04N" /></figure><p>In short, businesses want things to be done in a certain amount of time and they don’t want to spend more than a certain amount of money to do it.</p><p>This means that agency sales teams feel they need to promise clients exactly what they are asking for in order to win the pitch.</p><p>This way of thinking from clients to sales teams leads many agencies into adopting a waterfall approach from the start of their sales process and this can make it very difficult to transition into a more agile approach for project delivery since all of the estimates are already seen as “fixed” by the client. What do you do as a project manager or developer when you’re asked to produce more detailed estimates and they end up being more than the estimates that sales used to win the project? It puts project managers in a difficult position and invariably ends up in some very uncomfortable conversations with both the agency leadership and the client.</p><h3>So how do we avoid this?</h3><h4>Getting started</h4><p>Firstly we need to move the conversation from <em>features</em> and more towards <em>goals.</em> This is a subtle but important distinction to make. A feature is “how it’s done” whereas a goal is “the outcome we want”. Once the client is talking about their goals the “how we get there” is much more flexible.</p><p>We can then begin to refine the client’s high-level goals into more actionable requirements. These then form the high-level epics of the project and the next step is to get the people that will most likely be doing the work to give these high-level epics some estimates — but not <em>time </em>estimates.</p><h4>Time to play poker</h4><p>A good way to estimate these high-level epics, and my personally preferred method, is to use “Story Points” based on the Fibonacci sequence. Get the delivery people in a room (real or virtual) and play a game called “planning poker”.</p><p>Timebox each epic — 5 minutes for example — and allow the group to discuss it and ask questions to the people that worked with the client to define it. At the end of the 5 minutes, each person that will be involved in the delivery makes a secret “bid” of story points from the sequence below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*egEjKeGVuWlfdjgR" /></figure><h4>Fibonacci sequence</h4><blockquote>In the Fibonacci sequence, each number is the sum of the two preceding ones, starting from 0 and 1. The sequence “1, 2, 3, 5, 8, 13, 21” is commonly used for planning and estimation in software development projects.</blockquote><p>Everyone reveals their bid at the same time and if they are all the same that is the estimate for the epic. If there are differences you just discuss the outliers and come to a consensus quickly. Any discussion at this point should also be timeboxed — the idea is to estimate quickly and move on.</p><p>These estimates will give you an idea of the complexity of each epic and while these points don’t translate directly to time at this point, they are useful in determining where the majority of time will likely be spent.</p><p>Once you’ve estimated all of the epics look for any that have been awarded the highest value allowed in your sequence. These estimates typically come from a lack of knowledge or something that is too broad in scope. Each of the epics at the top end of the estimate range should be discussed separately to determine why the estimates are so high with a view to either getting more information from the client or breaking them down into more manageable pieces. Eventually, you should end up with a list of epics where each epic alone doesn’t feel like a big daunting piece of work and you feel like you have all of the information you will need to produce it.</p><h4>Going to MoSCoW</h4><p>Now that you have a list of well-defined requirements and an idea of how much effort each will require to deliver each, it’s time to go back to the client and talk about priorities.</p><p>I like using the “MoSCoW” system for this as it helps the clients to prioritise their requirements without getting bogged down in too much detail. Ask the client to mark each requirement as one of the following:</p><ul><li>Must have</li><li>Should have</li><li>Could have</li><li>Would like to have (but not this time)</li></ul><p>This process helps to define the intended scope of the project. Everything in the “Must”, “Should” and “Could” categories should be considered as “in-scope” at the start of the project.</p><p>Items in the “Would like to have” category can be kept in the project backlog as “stretch goals” but it should be clear to all parties that those items will not be planned into the completed project or worked on unless everything else is complete.</p><p>Prioritising items helps us understand the order in which features or stories should be completed. Ideally all of the “Must have” items would be completed before any “Should have” items are started, and so on.</p><h4>Expect the unexpected</h4><p>No project ever runs to completion without something changing. Whether it’s a new requirement, a change in the client’s business priorities, delays from third parties or just that one of the requirements ends up being more complicated than expected.</p><p>In these cases, the conversation with the client is much easier to start because they’ve been thinking about priorities all the way through so far. When that new priority comes in or the big “must-have” feature takes longer than expected we can talk to the client about either extending the budget/timeline or dropping one or more of the lower priority items from the project to take account of the change in circumstances.</p><p>Since, in an agile project, you’ll be talking to the client much more frequently than you would in the old waterfall method, they can be made aware of these things sooner avoiding any surprises towards the end of the project.</p><h3>What about the time and money?</h3><p>It’s a fact of business life that clients will want to have some assurances of both when they will get what they’re paying for and how much it’s going to cost them. In established agile teams it’s relatively easy to estimate a timeline for a project based on the team’s velocity (number of points completed over time) on previous projects. This is much harder to do in an agency where you may not be working with the same team members for every project.</p><p>It’s also a fact of software development that there will always be surprises in any project. There’s no way that we can know all of the ins and outs of a clients business processes at the start of a project. There will always be things that only come out once we start actually building the project and, most of the time, the project can cope with them but there are those occasions where a feature turns out to be far more complicated than originally described.</p><p>The answer is to change the question. Rather than promising fixed scope and a fixed budget to clients, just pick one. You know your client best. Which is more important to them; the budget or the scope?</p><p>Make sure that they understand that you will do as much as can be done well with the time/budget available. Things lower down their priority list may need to be dropped from the scope to achieve that. Most clients will be fine with this in the early stages of discovery and development and, if it becomes an issue later, you have set expectations early and at that point, the client can choose to either drop a low-priority feature or add to the budget so that it can still be completed. In most cases they will drop the feature since getting the project to market will be more important.</p><p><em>It’s better to get it to market and then improve on it than to never get it to market at all.</em></p><p>The other side of this is where the client must have all features to make their product viable. In these cases, they must be prepared to increase their budget to cover any surprises, or to be more flexible with the scope to allow lesser implementations of their features in version 1.</p><p>Overall, communication with the client is key.</p><p><em>Originally published at </em><a href="https://leeconlin.co.uk/blog/how-does-agile-work-in-an-agency"><em>https://leeconlin.co.uk</em></a><em> on July 26, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b31210d377ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 things to help make your new website project a success]]></title>
            <link>https://medium.com/distinctionuk/5-things-to-help-make-your-new-website-project-a-success-b1c307671876?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1c307671876</guid>
            <category><![CDATA[change]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[business-strategy]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 08:22:06 GMT</pubDate>
            <atom:updated>2020-03-06T08:22:06.996Z</atom:updated>
            <content:encoded><![CDATA[<p>In my career I’ve been through many different projects in different industries both working with “in-house” teams and with agencies. In this article I’m going to talk about some of the things I’ve found that make for a successful project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsHeug0WFqHbgpIMSE6yGg.jpeg" /></figure><h3>1. Well defined goals</h3><p>Whether you’re building a new website or rebuilding/updating an existing one you’re probably doing it for a reason.</p><p>Take some time to think about your reasons and how you will measure whether the project has been a success.</p><p>Perhaps you want to increase the number of people who submit your enquiry form? Maybe you just want people to spend longer on your site? Whatever the reason or reasons, document them and make sure that your project team are all aware of what you’re measuring.</p><p>Then you can use them to measure the success of your project.</p><h3>2. Ubiquitous language</h3><p>I’ve been in many projects where the terminology used by the client or stakeholders didn’t match up with that used by the development team.</p><p>When the you talk about a “widget” developers might be thinking about website widgets (ways of displaying dynamic content) but you might mean a product that you sell.</p><p>Early in your project, and throughout, whenever a term is used that has specific meaning to you, make sure you define that with the developers. They’ll thank you for it. If someone uses a term that you’re unfamiliar with, ask for clarification.</p><p>Work to get every person involved in your project speaking the same language and using the same terminology to mean the same things.</p><blockquote>For example, when I worked on a project for a publishing company my predecessor had created an object in code called “Book” … the publishers told me that there was no such thing in their world. They called them “Works” and “Editions”. A single “Work” or title by a particular author could have multiple “Editions” identified by their ISBN. This clarification helped me build massive improvements to their website and project because I had a better understanding of their systems and their data.</blockquote><h3>3. Good communication</h3><p>You may think this one goes without saying — but I’m saying it anyway. I’ve seen too many projects where clients were impossible to pin down for meetings or third party companies would miss important meetings.</p><p>Good, open communication between everyone involved in your project is the key to ensuring that things keep moving and that no one person involved is working in the wrong direction.</p><p>If you have 3rd party companies that need to do work (i.e. your CRM provider, an external IT services company, etc.), make sure that they understand the project and that they are allowed to communicate directly with your other project members. If you find anything that is a barrier to open communication, try to reduce or remove it.</p><h3>4. The right tool for the job</h3><p>Many projects I’ve worked on in the past have been hindered by the client already having their heart set on a particular piece of software (i.e. their preferred CMS) or technology stack (i.e. PHP vs .Net).</p><p>In many cases, and where there is not a commercial concern, these decisions should be left to your project team to allow them to select the best tool for the job at hand. For one thing, if they can use the tools they have the most experience with you are likely to get a much better solution but also, your choice may take more effort to integrate with your other systems or may not provide you with the most optimal solution for your users. Trust your project team and the specialists within it.</p><h3>5. Don’t be afraid of change</h3><p>As a project unfolds changes are inevitable. You might come up with something that you hadn’t thought of earlier. Your project team may discover that a particular integration is required that wasn’t known at the start.</p><p>In most cases you should work with your project team to identify these kinds of changes early on as they can, if left unchecked, increase the time and budget required to complete the project.</p><p>If you do find something that you just can’t afford to include, or that can’t be done in time for your deadline, don’t worry — there’s always a phase two!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1c307671876" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/5-things-to-help-make-your-new-website-project-a-success-b1c307671876">5 things to help make your new website project a success</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why user stories are important]]></title>
            <link>https://medium.com/distinctionuk/why-user-stories-are-important-9e3d87981fd7?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e3d87981fd7</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[specifications-writing]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Thu, 09 May 2019 06:49:57 GMT</pubDate>
            <atom:updated>2022-07-29T11:43:08.109Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why user stories are important to developers</h3><p>As a back-end developer at a <a href="https://distinction.co.uk/">digital product studio</a>, I often get asked to implement new features without a complete picture of what problem the feature is intended to solve or how it is planned to be used. Often, these details begin to emerge towards the end of the development or in UAT, at which point it often means a lot more work (and cost to the client) to make changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEb2cRT_X7V9Lbg9fEVETg.jpeg" /></figure><p>Often, they simply don’t think about it, assuming that I know their business as well as they do but on rare occasions, I have known clients to actively withhold such information on the flawed assumption that I don’t need so much information to write code.</p><p>This often leads to the client receiving a feature that is, at best, only partially what they expected and, at worst, not fit for purpose. In many cases it also means that the feature does not fit well into the client’s long-term roadmap, resulting in costly rework further down the road.</p><h3>How to write a good feature specification</h3><p>Writing good feature specifications can be a valuable skill for a project manager but I believe that clients need to be the driving force in most feature development and the better a client can write their request the better the outcome will be.</p><h4>Start with a high-level description</h4><p>Writing high-level descriptions can be challenging. As a minimum they should include:</p><ul><li>Who is the feature for? Who will use it?</li><li>What problem is this feature solving?</li></ul><p>I find that using the following format works well at this stage:</p><blockquote><strong>As a </strong>website visitor</blockquote><blockquote><strong>I want </strong>to set my contact preferences</blockquote><blockquote><strong>In order to </strong>avoid receiving emails thatI don’t want to see</blockquote><p>This “As a… I want… In order to…” notation helps to focus the feature writer into thinking about the purpose of the feature they are asking for. It can also help to avoid over-speccing a feature request by ensuring that each distinct feature gets its own spec.</p><h4>Next, move on to detail</h4><p>In the detail section of the specification, you should provide enough information for the developer to fully understand what the use-cases are.</p><p>A good way of doing this is to provide <em>scenarios</em>. For example:</p><blockquote><strong>Scenario: A logged in user accesses their contact preferences.</strong></blockquote><blockquote><strong>Given </strong>that I am logged in as a website visitor</blockquote><blockquote><strong>When </strong>I click on “My Account”</blockquote><blockquote><strong>And </strong>then I click on “Contact Preferences”</blockquote><blockquote><strong>Then </strong>I should see a checkbox for “Recieve updates by email”</blockquote><blockquote><strong>And</strong> I should see a checkbox for “Receive updates by SMS”</blockquote><p>This structured approach to scenarios is known as <a href="https://cucumber.io/docs/gherkin/reference/"><em>Gherkin Syntax</em></a><em>. </em>There are more structured elements and keywords that can be used and it makes the features form a kind of living documentation that <em>could </em>be turned into automated tests.</p><p>Each feature should contain multiple scenarios. Don’t just include the straight-forward, common ones either. Include any outliers or “edge cases” too. Things that are uncommon but do happen, especially where they cause issues when they do happen. These will help to flesh out the developer’s view of what you are trying to achieve.</p><p>In addition, it can be helpful to include scenarios to demonstrate what the feature <em>does not</em> do.</p><h4>Finally, write acceptance criteria</h4><p>At this stage, you need to create a simple concise bulleted list for each feature. Each item in the list must be true in order for the feature to be considered complete.</p><p>Once you&#39;ve written these, compare them to the scenarios in the feature. If there are any acceptance criteria that are not covered by a scenario you should go back and add scenarios as needed.</p><p>These acceptance criteria will be used as a checklist to determine if the feature is complete. The scenarios establish context and criteria that can be tested.</p><h3>A note on automated testing</h3><p>Automated testing can come in many forms. Using the syntax above can make writing automated tests simpler, however, you must also have <em>sufficient time and budget</em> to allow the developer to build automated tests.</p><p>This can seem like a large investment up front but the future benefits you will reap are well worth it:</p><ul><li>Preventing future changes from breaking earlier functionality (the already existing tests would fail)</li><li>Living documentation — the features and scenarios match the functionality and provide documentation for future developer onboarding and could even be used to train new users.</li><li>Allows incremental improvements — by tweaking and refactoring the code you can get some great performance, security and user experience benefits. The tests ensure that you don’t introduce bugs that break functionality.</li></ul><p>As always, automated tests can only do so much. They won’t pick up errors that they are not coded to detect. However, when you find a bug you just need to write a new scenario under the relevant feature, get your developer to write an associated automated test, then fix the bug. Doing it in this way will eliminate the possibility of the same bug recurring in the future since the test will live on.</p><h3>In summary…</h3><p>Writing better specifications and giving your developers the complete picture will help you to achieve better results in your projects and also help to build a great relationship with your developers. Happy developers will be more productive and can even come up with some great ideas for improving your systems if given the chance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e3d87981fd7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/why-user-stories-are-important-9e3d87981fd7">Why user stories are important</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending custom templated emails using the Kentico API]]></title>
            <link>https://medium.com/distinctionuk/sending-custom-templated-emails-using-the-kentico-api-95759bf2bdae?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/95759bf2bdae</guid>
            <category><![CDATA[kentico-development]]></category>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[kentico-cms]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[kentico-developers]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 26 Apr 2019 14:59:01 GMT</pubDate>
            <atom:updated>2019-04-26T14:59:01.294Z</atom:updated>
            <content:encoded><![CDATA[<p>I often find myself needing to send custom emails from my code in Kentico projects. To make life easier I created this method as a generic email sender.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yekY0hsnSf6MhUMhtDTSIA.jpeg" /></figure><p>I wrote this code in Kentico 10 but, as of writing this article, it was still good up to Kentico 12.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11808&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3981%2F11808&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e07d9febc0fc2ea8431bff2aa9bb4b9/href">https://medium.com/media/5e07d9febc0fc2ea8431bff2aa9bb4b9/href</a></iframe><p>This can be used in a Web Method to allow your front-end javascript to trigger specific email templates, or in your back-end code to do the same.</p><p>To use it, create a new email template in Kentico using the “General” email type. Then simply call the method, passing in the template codename, the recipient(s) email address(es) and a dictionary of data that you want to use in the template.</p><p>The keys from the dictionary will be what you use in the template. i.e. {%MyCustomData%} … and will be replaced by the associated value from the dictionary.</p><p>Hopefully, others will find this useful. Let me know in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95759bf2bdae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/sending-custom-templated-emails-using-the-kentico-api-95759bf2bdae">Sending custom templated emails using the Kentico API</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using forms in Kentico 12 MVC without the page builder]]></title>
            <link>https://medium.com/distinctionuk/using-forms-in-kentico-12-mvc-without-the-page-builder-22e42ba4ab04?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/22e42ba4ab04</guid>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[kentico-developers]]></category>
            <category><![CDATA[kentico-cms]]></category>
            <category><![CDATA[kentico-development]]></category>
            <category><![CDATA[mvc]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Wed, 17 Apr 2019 07:49:40 GMT</pubDate>
            <atom:updated>2019-04-17T07:49:40.684Z</atom:updated>
            <content:encoded><![CDATA[<p>Kentico 12 MVC is amazing. Its a huge step forward for a CMS that has so much power and provides so much customisation ability to developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Y89w9gsUzur0SUHiyPDrWw.jpeg" /></figure><p>That said, the forms have caused me some headaches over the last few months as I’ve encountered the same situation several times… a client that wants to have a Kentico form (bizform) rendered on every page that uses a particular MVC layout.</p><p>Out of the box, Kentico has no way to do this and still maintain the form-builder functionality allowing the client to edit the form components, validation settings, etc.</p><p>The only officially supported method for placing a form on a page is to use the page builder and place the “Form” widget into an editable area on the page. Since the page builder saves the data about its widgets on a per-page basis this becomes impractical for my use-case.</p><p>In this article, I’m going to describe, with code examples, how I overcame this and produced working forms that render correctly, validate correctly and respect the settings and configuration of the form from Kentico.</p><h3>Displaying the form</h3><p>To display the form and have Kentico render any custom form-sections correctly you will need 4 pieces of information.</p><ol><li>The collection of FormComponent objects</li><li>The FormBuilderConfiguration</li><li>An HTML element ID that will be used to wrap the form and allow multiple instances on a single page</li><li>The form’s codename</li></ol><h4>Getting the FormComponent collection</h4><p>We first get the BizForm formInfo; from Kentico using the form codename. This gives the basic information we need to get the form components from the FormProvider .</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11251&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3792%2F11251&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b79f105738061e334d82e60886ca2da/href">https://medium.com/media/3b79f105738061e334d82e60886ca2da/href</a></iframe><h4>Getting the FormBuilderConfiguration</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11252&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3792%2F11252&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecbd2722bea94542bd5c5dc4aedfb44a/href">https://medium.com/media/ecbd2722bea94542bd5c5dc4aedfb44a/href</a></iframe><h4>Rendering the form</h4><p>The two objects, formComponents and formConfiguration should be passed to the view in addition to the element ID and the form’s codename.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11253&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3792%2F11253&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f8db3b7c15ff682bb8ffbe1a135584/href">https://medium.com/media/06f8db3b7c15ff682bb8ffbe1a135584/href</a></iframe><p>This should correctly render the form markup based on the Form Sections and Components used in the Form Builder.</p><p>The ElementId property in the model should be set to a valid HTML id value. This is used to ensure that the form remains self-contained and that you can use the partial view with different ElementId values in multiple places on the page.</p><h3>Handling the form submission</h3><p>You will need a controller action to handle the form submissions.</p><h4>Saving the form</h4><p>In order to save the submitted form, you need to convert the form components back into a form item record.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11254&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3792%2F11254&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/603b9287a0a58137dc181742a085bba0/href">https://medium.com/media/603b9287a0a58137dc181742a085bba0/href</a></iframe><h4>Honouring Kentico form settings</h4><p>In Kentico, you have the option to configure the behaviour of the form after it is submitted. i.e. whether it should remain on the form, redirect to a different URL or show a message in place of the form.</p><p>Fortunately, we can access this information and take action accordingly. Continuing from the form-save above…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F11255&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Fcollections%2F3424%2F3792%2F11255&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eefbcf5428a4836f7fc1bd52ad8fe9fe/href">https://medium.com/media/eefbcf5428a4836f7fc1bd52ad8fe9fe/href</a></iframe><h3>In closing</h3><p>This is far from an ideal solution but it works. Hopefully, Kentico will open up some of the internal classes and interfaces to allow for a simpler extension of forms in future versions.</p><p>If you have a better way of doing it or improvements on the method described here, feel free to leave me a note in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22e42ba4ab04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/using-forms-in-kentico-12-mvc-without-the-page-builder-22e42ba4ab04">Using forms in Kentico 12 MVC without the page builder</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing a CMS for your business]]></title>
            <link>https://medium.com/distinctionuk/choosing-a-cms-for-your-business-ccade9cd7652?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccade9cd7652</guid>
            <category><![CDATA[business-strategy]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cms]]></category>
            <category><![CDATA[content-management-system]]></category>
            <category><![CDATA[website]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Mon, 18 Mar 2019 08:01:00 GMT</pubDate>
            <atom:updated>2019-03-25T12:07:35.700Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a multitude of content management systems available on the market today ranging in price from “free” to thousands of pounds/dollars and I often find clients gravitating towards the “free” ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*unr6LjjiMoaC30smr0KDjw.jpeg" /></figure><h3>What does “free” mean?</h3><p>I want to dispel the illusion of what “free” means in terms of creating a website and selecting a CMS.</p><p>Generally, a “free” CMS is one that you don’t have to pay any licensing fee to use. I use quote marks around “free” because the word alone implies that there is no cost to using the CMS in question… this is the illusion.</p><p>Even a “free” CMS, such as Wordpress, Drupal or Joomla, will require both time and money to be effective. There’s no such thing as a free lunch — or a free CMS.</p><h4>Time</h4><p>Time will be spent customising the theme of the site, creating pages and initial content and in most cases creating custom functionality or integrations.</p><p>More time will be spent post-launch creating new content, updating old content and generally keeping the site “fresh”. Without this, your search rankings will degrade over time.</p><h4>Money</h4><p>The time you and your employees spend getting the site ready for production use costs money.</p><p>You also have to host it somewhere, this costs money. Generally speaking, if you skimp on the hosting the site will be slow and perform poorly, reducing its usefulness and its return on investment.</p><p>Finally, there is <em>almost always</em> some form of custom behaviour, functionality or integration that is required. To acquire this you will need to pay a developer.</p><p>In addition, a typical website has a lifespan or 3–5 years before the design begins to look old and outdated. After this time you will need to look at refreshing the site design. It’s also possible that your requirements will have changed in that time and you might even want to “rebuild” the site to take advantage of newer technology.</p><h4>Total cost of ownership</h4><p>You’ve probably heard this term before. TCO or Total Cost of Ownership refers to how much money you will spend on your website over the course of its life.</p><p>If you assume that a given incarnation of a website lasts up to 5 years, that’s:</p><ul><li>5 years of hosting fees</li><li>5 years of paying employees to update the website content</li><li>5 years of a support retainer (without this if your site goes down you’re on your own!)</li><li>Ad-hoc payments to developers to make additional functionality changes to your website to accommodate changing business needs</li><li>Ad-hoc payments to designers to make design changes, landing pages, etc. based on business requirements</li><li>Digital marketing to bring people to your site (such as Google Ads, SEO work, etc)</li></ul><h3>So how do you choose?</h3><h4>Workflow &amp; Process</h4><p>Start by understanding your own work-flow and processes.</p><ul><li>Who will update the website?</li><li>How often?</li><li>Are there any other systems involved that need to be integrated with the website?</li><li>Who is your intended audience?</li><li>Why do people come to your site?</li></ul><p>By understanding these things you can choose a CMS that will optimise the time you spend managing the website. The more efficiently you and your staff can accomplish tasks on the website the less time you will spend on the website allowing you and your employees to be more productive elsewhere in your business.</p><p>Use this understanding to create a “short-list” of 2–3 CMS that meet your requirements.</p><h4>Customisation</h4><p>Some content management systems are very easy to extend and customise, acting more like a framework than an “out of the box” website. Others will get you up and running with a basic site much faster but will be that much harder (and more costly) to customise later.</p><p>Think about what customisations you might need and what other systems you want to integrate the website with. Ask your developers to review the short-list of CMS, keeping the customisations &amp; integrations you will need in mind.</p><p>They should be able to tell you which one will be the easiest to work with from a development perspective. This usually means less time spent developing which can lead to cost savings, though you will have to find the balance that works for you and your business.</p><h3>A different path</h3><p>So far I’ve been talking mostly about traditional “monolithic” CMS. The kind of CMS where the “editor” area and the “visitor” area of the application generally reside on the same web server and use the same database.</p><p>These have their place, but there is a new option available now… Headless CMS.</p><p>A headless CMS offers you more flexibility in how you use your content but it also requires a radical change in how you think about your content.</p><p>Consider, instead of thinking about “pages” or “blogs” you begin to think of your content in a more structured way. A blog might be an “article” or a “recipe” or an “instruction manual”. These are very different types of content.</p><p>Before you’d have just created these each as “blog pages” and placed the content in some kind of “rich text” editor field that spits out HTML code to be rendered on the website.</p><p>Now, with structured content, they are each their own specialised “content model” with fields specially tailored to their purpose. A recipe will have a list of ingredients. An ingredient will have a name, description and measurement.</p><p>All of a sudden this same content can be used anywhere.</p><p><strong><em>“Alexa, find me a recipe with rice”</em></strong></p><h4>How does headless work?</h4><p>There are many headless providers out there (<a href="https://kenticocloud.com/">Kentico Cloud</a>, <a href="https://graphcms.com/">GraphCMS</a>, <a href="https://buttercms.com/">ButterCMS</a> and others) but they all work in a similar way.</p><p>Your content is stored within a CMS-Service hosted by the headless provider. The provider gives you access to a web-service or “API” that your developers use to retrieve content items from the CMS.</p><p>This means that you can build the front-end of your website independently from the CMS. You must also host it somewhere too, but generally, this hosting will be a little cheaper because you don’t need a database or media storage and the server isn’t doing as much because your editors are not also using its resources when editing content.</p><p>Another benefit is that you can move the front-end hosting easily without needing to re-do any content. You can even have multiple front-ends serving the same content in different formats:</p><ul><li>Website</li><li>Voice assistants</li><li>Digital billboards</li><li>Social media platforms</li></ul><h4>What does headless cost?</h4><p>The price varies from provider to provider, as do the available features. A typical cost breakdown might look like this:</p><ul><li>CMS monthly service cost</li><li>Hosting for the website front-end</li><li>Up-front developer fees to build the custom front-end</li></ul><p>Also, remember the “total cost of ownership” I talked about above. You’ll still have the ongoing “5-year” costs to think about but if you consolidate your content management for multiple channels into a single unified headless solution then headless could reduce your overall costs in the process.</p><h3>In conclusion</h3><p>Choosing a CMS is a big decision as you’ll be stuck with it for at least the next 3–5 years in most cases. Take your time and weigh all of your options.</p><p>If in doubt, talk to a few digital agencies and get their opinions, they’ll often have done much of the leg-work from the development side already and with a little understanding of your business and processes they should be able to recommend a couple for you to look at.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccade9cd7652" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/choosing-a-cms-for-your-business-ccade9cd7652">Choosing a CMS for your business</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kentico & RabbitMQ Integration: Part 3 — External Workers]]></title>
            <link>https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-3-external-workers-4b34b370a5ec?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b34b370a5ec</guid>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 15:05:48 GMT</pubDate>
            <atom:updated>2019-03-08T15:05:48.064Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kentico &amp; RabbitMQ Integration: Part 3 — External Workers</h3><p>This is the third article in our RabbitMQ integration series, where we show you how to to build robust and scalable integrations using Kentico, RabbitMQ and message driven development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*XB9ojbVY88JxQMqyx2xBqQ.jpeg" /></figure><p>In the first article, <a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-1-outbound-integration-7c1cdb15b38a">Outbound Integration</a>, I talked about how to configure Kentico to send messages to RabbitMQ for processing by one or more external systems.</p><p>In the second article, <a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-2-inbound-integration-592e550f82b2">Inbound Integration</a>, I described how to configure Kentico to receive inbound messages from those external systems.</p><p>In this article I will detail how to create a separate application to act as a “worker”, and how to run multiple instances of this worker simultaneously. This will allow you to rapidly process even high-volume message queues.</p><h3>Setup</h3><h3>Assumptions</h3><p>For the purposes of this article:</p><p>1. You importing products from an external system</p><p>2. The messages in the your queue all follow the same format. This is good practice when setting up your queues.</p><p>3. There will be three types of message you might receive: full product, price update, stock update.</p><h3>Message formats</h3><p>All three types of message will follow the same format:</p><pre>{  <br>	    &quot;messageType&quot;: &quot;&quot;,  <br>	    &quot;messageSent&quot;: &quot;2018-09-04T09:28:00Z&quot;  <br>	    &quot;data&quot;: {  </pre><pre>	    }  <br>	}</pre><p>The messageType property may contain one of the following values:</p><ul><li>Product</li><li>Price</li><li>StockLevel</li></ul><p>The data property will contain an object appropriate to the type. Examples of each below:</p><h3>Product</h3><pre>{  <br>	    &quot;messageType&quot;: &quot;Product&quot;,  <br>	    &quot;messageSent&quot;: &quot;2018-09-04T09:28:00Z&quot;  <br>	    &quot;data&quot;: {  <br>	        &quot;productCode&quot;: &quot;TEST001&quot;,  <br>	        &quot;productName&quot;: &quot;Test product&quot;,  <br>	        &quot;productPriceExVat&quot;: 124.99,  <br>	        &quot;productSummery&quot;: &quot;A short description of the product goes here&quot;,  <br>	        &quot;productDescription&quot;: &quot;A longer description can go here. This field could include HTML code.&quot;,  <br>	        &quot;productMainImageUrl&quot;: &quot;http://www.somedomain.com/path/to/image.jpg&quot;,  <br>	        &quot;productAdditionalImages&quot;: [ /* An array of image URL&#39;s as strings */ ],  <br>	        &quot;productStockAvailable&quot;: 123,  <br>	        &quot;productAllowedForSale&quot;: true  <br>	    }  <br>	}</pre><h3>Price</h3><pre>{  <br>	    &quot;messageType&quot;: &quot;Price&quot;,  <br>	    &quot;messageSent&quot;: &quot;2018-09-04T09:28:00Z&quot;  <br>	    &quot;data&quot;: {  <br>	        &quot;productCode&quot;: &quot;TEST001&quot;,  <br>	        &quot;productPriceExVat&quot;: 124.99,  <br>	        &quot;productAllowedForSale&quot;: true  <br>	    }  <br>	}</pre><h3>StockLevel</h3><pre>{  <br>	    &quot;messageType&quot;: &quot;StockLevel&quot;,  <br>	    &quot;messageSent&quot;: &quot;2018-09-04T09:28:00Z&quot;  <br>	    &quot;data&quot;: {  <br>	        &quot;productCode&quot;: &quot;TEST001&quot;,  <br>	        &quot;productStockAvailable&quot;: 123,  <br>	        &quot;productAllowedForSale&quot;: true  <br>	    }  <br>	}</pre><h3>Creating the Application</h3><p>I will be building the application as a .NET Framework 4.7 Console application. The project type is largely unimportant, and you may wish to use a different project type depending on your infrastructure.</p><p>Create your solution in Visual Studio and install the packages below.</p><ul><li>RabbitMQ.Client</li><li>Kentico.Libraries</li><li>Newtonsoft.Json</li></ul><p>Once installed you will need to add your Kentico connection string to the web.config with the name “CMSConnectionString”.</p><p>Now that the skeleton application is set up I will begin the development by adding the interfaces and classes that I’ll need.</p><h3>Interfaces</h3><h3>Message model</h3><p>I described this briefly in <a href="https://distinction.co.uk/kentico-rabbitmq-integration-part-1-outbound-integration">part 1</a> of this series:</p><pre>public interface IRabbitMqMessageModel&lt;T&gt;  <br>	    where T : class  <br>	{  <br>	    string MessageType { get; set; }  <br>	    DateTime MessageSent { get; set; }  <br>	    T Data { get; set; }  <br>	}</pre><p>You’ll notice that this mirrors the JSON message model above. When creating concrete classes using this interface we can tell each class what the type “T” is using the generic interface.</p><h3>Message processor</h3><p>I will have a separate class to process each type of message. This interface will ensure that these classes will all have the same public signature.</p><pre>public interface IMessageProcessor&lt;T, T2&gt;  <br>	where T : class, IRabbitMqMessageModel&lt;T2&gt; <br>	where T2 : class<br>	{  <br>	    void Execute(T data);  <br>	}</pre><p>In this case the type “T” will be the exact type of the message model for this processor.</p><h3>Data model classes</h3><p>These classes will form the basis of all data moving through this worker and will closely mirror the “data” property from the JSON objects detailed above.</p><h3>Product data model</h3><pre>public class ProductDataModel{  <br>	    public string ProductCode { get; set; }  <br>	    public string ProductName { get; set; }  <br>	    public decimal ProductPriceExVat { get; set; }  <br>	    public string ProductSummary { get; set; }  <br>	    public string ProductDescription { get; set; }  <br>	    public string ProductMainImageUrl { get; set; }  <br>	    public IEnumerable&lt;string&gt; ProductAdditionalImages { get; set; }  <br>	    public int ProductStockAvailable { get; set; }  <br>	    public bool ProductAllowedForSale { get; set; }  <br>	}</pre><h3>Price data model</h3><pre>public class PriceDataModel{  <br>	    public string ProductCode { get; set; }  <br>	    public decimal ProductPriceExVat { get; set; }  <br>	    public bool ProductAllowedForSale { get; set; }  <br>	}</pre><h3>Stock level data model</h3><pre>public class StockLevelDataModel{  <br>	    public string ProductCode { get; set; }  <br>	    public int ProductStockAvailable { get; set; }  <br>	    public bool ProductAllowedForSale { get; set; }  <br>	}</pre><h3>Message model classes</h3><p>These message model classes form the final piece of the puzzle that will allow me to use Newtonsoft.Json to directly de-serialise the message from the queue into a strongly typed object model.</p><p>This is an easy way to get the data out of the messages quickly and efficiently.</p><h3>Product message model</h3><pre>public class ProductMessageModel : IRabbitMqMessageModel&lt;ProductDataModel&gt;{  <br>	    public string MessageType { get; set; }  <br>	    public DateTime MessageSent { get; set; }  <br>	    public ProductDataModel Data { get; set; }  <br>	}</pre><h3>Price message model</h3><pre>public class PriceMessageModel : IRabbitMqMessageModel&lt;PriceDataModel&gt;{  <br>	    public string MessageType { get; set; }  <br>	    public DateTime MessageSent { get; set; }  <br>	    public PriceDataModel Data { get; set; }  <br>	}</pre><h3>Stock level message model</h3><pre>public class StockLevelMessageModel : IRabbitMqMessageModel&lt;StockLevelDataModel&gt;{  <br>	    public string MessageType { get; set; }  <br>	    public DateTime MessageSent { get; set; }  <br>	    public StockLevelDataModel Data { get; set; }  <br>	}</pre><h3>The message processor classes</h3><p>At this point you could have a single class that deals with importing any/all of the three message types using a switch statement on the MessageType property, but that would break the first rule of SOLID development: each class must have a single responsibility.</p><p>To that end I would create a separate class for each of the three message types. This pattern also makes the system easily extendible — you could add new message types later along with a class for each to process them.</p><p>These classes will implement the IMessageProcessor&lt;&gt; interface and the Execute method will process the single product in the message, inserting or updating as necessary within Kentico.</p><p>The ProductMessageProcessor class will look like this at its most basic:</p><pre>public class ProductMessageProcessor : IMessageProcessor&lt;ProductMessageModel, ProductDataModel&gt;  <br>	{  <br>	    public void Execute(ProductMessageModel data)  <br>	    {  <br>	              <br>	    }  <br>	}</pre><p>Within the Execute method you should perform any logic needed to insert/update the product in Kentico — See <a href="https://docs.kentico.com/api11/e-commerce/products">Kentico’s documentation</a> for details on how to do this.</p><p>The other message processors will look very similar in construction thanks to the common IMessageProcessor interface. The main difference will be in the DataModel that is used in the generic definition.</p><p>Once you have the message processors done, its time to bring it all together…</p><h3>The main application thread</h3><p>In the Main method of Program.cs in my console application I would set it up as follows:</p><pre>private static readonly ManualResetEvent QuitEvent = new ManualResetEvent(false);  <br>	static void Main(string[] args)  <br>	{  <br>	    Console.CancelKeyPress += (sender, eventArgs) =&gt;  <br>	    {  <br>	        QuitEvent.Set();  <br>	        eventArgs.Cancel = true;  <br>	    };  <br>	  <br>	    Setup();  <br>	  <br>	    DoWork();  <br>	  <br>	    QuitEvent.WaitOne();  <br>	  <br>	    GracefulClosedown(); // An optional method to handle cleanup on shutdown<br>	}</pre><p>The QuitEvent allows us to keep the application running indefinitely, allowing us to utilise the “subscription” method of receiving messages from the queue without the need of an infinite loop.</p><p>In the Setup method I configure the RabbitMQ connection…</p><pre>private static IConnection _rabbitMqConnection;  <br>	private static IModel _rabbitMqChannel;  <br>	  <br>	private static void Setup()  <br>	{  <br>	    var factory = new ConnectionFactory  <br>	    {  <br>	        UserName = ConfigurationManager.AppSettings[&quot;RmqUserName&quot;],  <br>	        Password = ConfigurationManager.AppSettings[&quot;RmqPassword&quot;],  <br>	        VirtualHost = ConfigurationManager.AppSettings[&quot;RmqVirtualHost&quot;],  <br>	        HostName = ConfigurationManager.AppSettings[&quot;RmqHostName&quot;],  <br>	        RequestedHeartbeat = 150,  <br>	        Ssl = new SslOption  <br>	        {  <br>	            ServerName = ConfigurationManager.AppSettings[&quot;RmqHostName&quot;],  <br>	            Enabled = false,  <br>	            AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch &amp; SslPolicyErrors.RemoteCertificateNotAvailable &amp; SslPolicyErrors.RemoteCertificateChainErrors  <br>	        }  <br>	    };  <br>	  <br>	    IConnection service = null;  <br>	    try  <br>	    {  <br>	        service = factory.CreateConnection();  <br>	    }  <br>	    catch (BrokerUnreachableException ex)  <br>	    {  <br>	        // You could add logging here.  <br>	        QuitEvent.Set(); // allow the app to closedown gracefully  <br>	    }  <br>	  <br>	    if (service == null)  <br>	    {  <br>	        // You could log this too  <br>	        QuitEvent.Set();  <br>	        return;  <br>	    }  <br>	  <br>	    _rabbitMqConnection = service;  <br>	    _rabbitMqChannel = service.CreateModel();  <br>	    _rabbitMqChannel.ExchangeDeclare(&quot;ProductsExchange&quot;, ExchangeType.Direct);  <br>	    _rabbitMqChannel.QueueDeclare(&quot;ProductsQueue&quot;, false, false, false, null);  <br>	    _rabbitMqChannel.QueueBind(&quot;ProductsQueue&quot;, &quot;ProductsExchange&quot;, &quot;ProductsQueue&quot;);  <br>	}</pre><p>Then, in the DoWork method I register the handler method for consuming the messages by subscription…</p><pre>private static void HandleMessage(object sender, BasicDeliverEventArgs e)  <br>	{  <br>	    var message = e.Body;  <br>	  <br>	    var messageModel = JsonConvert.DeserializeObject&lt;IRabbitMqMessageModel&lt;object&gt;&gt;(Encoding.UTF8.GetString(message));  <br>	  <br>	    // Through the use of reflection this switch could be replaced   <br>	    // with dynamic selection of the correct message processor  <br>	    // removing the need for manual code updates here when new ones are added.  <br>	    try  <br>	    {  <br>	        switch (messageModel.MessageType.ToLowerInvariant())  <br>	        {  <br>	            case &quot;product&quot;:  <br>	                new ProductMessageProcessor().Execute ((ProductMessageModel) messageModel);  <br>	                break;  <br>	  <br>	            case &quot;price&quot;:  <br>	                new PriceMessageProcessor().Execute((PriceMessageModel) messageModel);  <br>	                break;  <br>	  <br>	            case &quot;stocklevel&quot;:  <br>	                new StockLevelMessageProcessor().Execute((StockLevelMessageModel) messageModel);  <br>	                break;  <br>	        }  <br>	    }  <br>	    catch (Exception ex)  <br>	    {  <br>	        // if something went wrong, log it and NACK the message.  <br>	  <br>	        _rabbitMqChannel.BasicNack(e.DeliveryTag, false, true);  <br>	    }  <br>	  <br>	    // If we get here then we successfully completed the message  <br>	    _rabbitMqChannel.BasicAck(e.DeliveryTag, false);  <br>	}</pre><h3>In closing</h3><p>I’ve used RabbitMQ in several integration projects to date and have found it to provide an amazing level of scalability and reliability, even when dealing with huge amounts of data.</p><p>I hope that this series has been as useful for you to read as it was enjoyable for me to write and has inspired you to try out RabbitMQ as an integration tool with Kentico and other projects .</p><p>Please let us know your thoughts in the comments by reaching out on <a href="https://www.linkedin.com/company/distinction-limited">LinkedIn</a>, <a href="https://www.facebook.com/Distinction-416119568593749/">Facebook</a> or <a href="https://twitter.com/DistinctionUK?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">Twitter</a>, and stay tuned for more Kentico articles.<br> <br> At Distinction, we are Kentico specialists and certified gold partners. If you are interested in working with us, <a href="https://distinction.co.uk/contact">get in touch</a> today to see how we can help your business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b34b370a5ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-3-external-workers-4b34b370a5ec">Kentico &amp; RabbitMQ Integration: Part 3 — External Workers</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kentico & RabbitMQ Integration: Part 2 — Inbound Integration]]></title>
            <link>https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-2-inbound-integration-592e550f82b2?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/592e550f82b2</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 15:03:15 GMT</pubDate>
            <atom:updated>2019-05-21T15:23:36.055Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kentico &amp; RabbitMQ Integration: Part 2 — Inbound Integration</h3><p>In my <a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-1-outbound-integration-7c1cdb15b38a">previous article</a> I talked about how to send data out of Kentico using RabbitMQ as the message queuing server.</p><p>In this article I’m going to look at how you can receive data into Kentico from an external source via a RabbitMQ message queuing server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*XB9ojbVY88JxQMqyx2xBqQ.jpeg" /></figure><h3>Setup</h3><p>I’ll assume for the purposes of this article that you have already followed the “Setup” section in Part 1 and that the inbound messages from the third-party system that you’ll be receiving will follow the same structure and model as those that we sent in Part 1.</p><h3>Polling vs subscription</h3><p>There are two methods by which you can receive messages from a RabbitMQ server: polling and subscription.</p><h3>Polling</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*KDhgsg-jaa9pUuIz.png" /></figure><p>Polling involves your application making a request to the RabbitMQ server to retrieve each message (or no message if none are in the queue). This can be a good way to ensure that the messages are retrieved if you need to ensure that your application controls how and when the messages are retrieved.</p><h3>Subscription</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*WyrirMvn0BTzI8IU.png" /></figure><p>With subscription, your application simply opens a connection to RabbitMQ and subscribes to one or more queues. The RabbitMQ server will then push new messages down to your application as and when they arrive in the queue and your application is ready to receive them.</p><h3>Which is better?</h3><p>The answer is that it really depends on your situation.</p><p>If you need to control the exact timing of the message processing, then the polling method might work better for you — for example, if you only wanted to process the information at certain times of day.</p><p>If you need to get the messages processed as quickly as possible then the subscription method might be a better fit since your workers will get the messages as soon as they are available.</p><p>With either method, it is possible to have multiple workers to consume the messages from the queue, allowing for far more scalability.</p><p>Personally, I prefer the subscription method. It takes the management of connections and timing out of your hands and lets RabbitMQ handle it, but this is only a personal preference based on my experience with RabbitMQ and the projects I have used it in. I’ll describe both methods below so that you can use the method that best suits your situation.</p><h3>A quick note on web farms</h3><p>If you use Kentico’s web farms feature, you can process messages on each server in parallel — improving performance.</p><p>It should be noted though that you may need to also create web farm tasks to ensure caches are cleared or actions are taken on all web farm servers depending on the work being done.</p><h3>Configure polling</h3><p>To use polling, you will need some way of running your polling code on a schedule. Fortunately, Kentico has a great scheduled task system built-in.</p><p>Create a new scheduled task class as per the Kentico <a href="https://docs.kentico.com/k11/custom-development/miscellaneous-custom-development-tasks/scheduling-custom-tasks">documentation</a>. Configure your task to execute every 1 minute (the shortest time interval at which they can run by default).</p><p>Next (because you will now need access to the RabbitMQ channel object in both your module class and this new scheduled task) you will need to abstract your setup code out of your module’s OnInit method into a static helper method or singleton service that returns the _channel variable. It’s important that everywhere that you access the queue(s) that you use that they are configured in the same way — abstracting the code that performs the setup allows us to achieve this.</p><p>Then, within the Execute() method of your custom task you will need to add some code to request one or more messages from the queue and process them.</p><p>Receiving a message is as simple as this:</p><pre>var message = _channel.BasicGet(_queueName, false);</pre><p>The “Body” property on the message will contain a byte-array which is the text contents of the message. If you were receiving one of the messages sent in part 1, this would be a JSON object which you could now deserialise as follows:</p><pre>var messageModel = <br>JsonConvert.DeserializeObject&lt;UserMessageModel&lt;InsertUserModel&gt;&gt;(Encoding.UTF8.GetString(message.Body));</pre><p>Now that you have the model decoded you can do anything you need to do with it. You could also wrap the above code in a loop to process multiple messages in each pass or use the <a href="https://distinction.co.uk/thoughts/kentico-scheduled-tasks-tips-tricks">scheduled task tips &amp; tricks I talked about in a previous article</a> to enhance the processing capabilities of the task.</p><p>Finally, once you have completed the processing for each message you must send an acknowledgement back to the RabbitMQ server to let it know that it can release that message from the queue. Failure to do this may result in the message being delivered to you multiple times:</p><pre>_channel.BasicAck(message.DeliveryTag, false);</pre><p>It is also possible to return a “not acknowledged” response back to the server as well, to tell the server that something went wrong and that the message was not processed.</p><pre>_channel.BasicNack(message.DeliveryTag, false, requeue: true);</pre><p>The “requeue” parameter tells RabbitMQ whether the message should be requeued for another try. In places where you know the failure is permanent you should set this to false.</p><h3>Configure subscription</h3><p>To use subscription, you will need to do things a little differently.</p><p>Instead of a scheduled task, you can register a consumer within your module’s OnInit method:</p><pre>var consumer = new EventingBasicConsumer(_channel);</pre><p>Next, you need to register an event handler for the “Received” event:</p><pre>consumer.Received += ConsumerOnReceived;</pre><p>Then you’ll need to write the method to handle the messages. This method will be called for each individual message that RabbitMQ delivers to your application:</p><pre>private void ConsumerOnReceived(object sender, BasicDeliverEventArgs message)<br>{<br>    var messageModel = JsonConvert.DeserializeObject&lt;UserMessageModel&lt;InsertUserModel&gt;&gt;(Encoding.UTF8.GetString(message.Body));</pre><pre>    // Handle your message here</pre><pre>    // Then acknowledge the message<br>    _channel.BasicAck(message.DeliveryTag, false);<br>}</pre><p>Finally, you need to register the consumer with the channel for the relevant queue:</p><pre>_channel.BasicConsume(&quot;queueName&quot;, autoAck: false, consumer: consumer);</pre><p>Now, RabbitMQ will send messages directly to your application whenever there are messages in the queue. By default, it will initially deliver 10, then as each message is acknowledged it will deliver one more to replace it.</p><p>It’s worth noting that you can have your consumer automatically acknowledge the messages it receives by setting the autoAck parameter to true, however doing so can present a risk that messages that fail to process correctly are removed from the queue and lost. I find that it’s always better to manually acknowledge the messages once the process has successfully completed.</p><h3>Wrapping up</h3><p>Now that you know how to send messages to RabbitMQ and how to receive them you’re all set to create new integrations that are more scalable and can handle much larger volumes of data as well as being able to communicate out to potentially unknown external systems.</p><p>In the next article I’ll take the scalability aspect of this process further and detail an architecture that can scale in multiple ways to more easily accommodate surges in usage.</p><p>At Distinction, we are Kentico specialists and certified gold partners. If you are interested in working with us, <a href="https://distinction.co.uk/contact">get in touch</a> today to see how we can help your business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=592e550f82b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-2-inbound-integration-592e550f82b2">Kentico &amp; RabbitMQ Integration: Part 2 — Inbound Integration</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kentico & RabbitMQ Integration: Part 1 — Outbound Integration]]></title>
            <link>https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-1-outbound-integration-7c1cdb15b38a?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c1cdb15b38a</guid>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 14:58:57 GMT</pubDate>
            <atom:updated>2019-03-08T14:58:57.069Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kentico &amp; RabbitMQ Integration: Part 1 — Outbound Integration</h3><h3>Preface — Kentico’s integration options</h3><p>Kentico has an excellent, built-in message queuing integration system called the <a href="https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-integration-bus/integration-bus-overview">Integration Bus</a>. The Integration Bus does its job very well and I encourage anyone thinking of an integration between Kentico and some external system to consider it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*XB9ojbVY88JxQMqyx2xBqQ.jpeg" /></figure><p>It does come with some downsides though. The integration tasks created by the connectors are processed within the scope of Kentico’s scheduled task system. This means that, depending on your configuration, the tasks may be processed or triggered within the context of a web request.</p><p>Depending on the nature of your integration, the amount of data that you’re synchronising or the number of records, this can lead to timeouts or to other tasks being blocked. You could avoid this by running the relevant tasks using the Windows Service task runner that Kentico provides but in practice I find that almost no one does this.</p><p>Additionally, I find that the handling of errors within integration connectors is uninspiring. In most cases I see, the errors are simply logged to the Kentico event log as “Error and skip” or just “Error” by Kentico and the task left in an “failed” state. While this might be fine if checked regularly and dealt with they often are simply ignored by developers and clients alike at this point. This leads to a lot of noise in the event logs that can obscure other, more meaningful errors.</p><p>In this series of articles, I’m going to explore an alternative that can provide a more scalable solution to much higher volumes of data as well as providing better handling and notification of errors in the integration.</p><h3>Assumptions</h3><p>In this article I’ll assume that you know how to create custom modules in Kentico and have a custom module in place into which the code in this article can be placed.</p><p>To use RabbitMQ as a messaging server you will first need to either set it up on your own infrastructure or purchase a cloud-hosted instance.</p><p>I’m not going to cover these processes in this article. I’ll also be assuming that you already have access to a RabbitMQ server.</p><p>If you need information on how to setup your own RabbitMQ server please refer to the <a href="http://www.rabbitmq.com/">RabbitMQ documentation</a>.</p><p>If you would prefer to purchase a cloud-hosted instance, there are many providers available. A <a href="https://www.google.co.uk/search?client=opera&amp;q=rabbitmq+cloud">quick Google search</a> will help you find the right one.</p><h3>Setup</h3><h3>Adding RabbitMQ to your solution</h3><p>Once you have a RabbitMQ instance you will need to install the .Net client package into your Kentico solution or module class library project. Use the following command in the package manager console to install the package:</p><pre>Install-Package RabbitMQ.Client</pre><p>Once installed you need to add some configuration to our custom module class.</p><p>First, add the “using” statement to the top of your class file:</p><pre>using RabbitMQ.Client;</pre><p>Then, in the module classes OnInit() method, add the setup code below:</p><pre>ConnectionFactory factory = new ConnectionFactory();<br>factory.Uri = new Uri(&quot;amqp://user:pass@hostName:port/vhost&quot;);</pre><pre>IConnection conn = factory.CreateConnection();</pre><p><strong><em>Hint: You may want to keep your credentials in Kentico Settings keys or in your web.config appsettings.</em></strong></p><p>Next, you need to create a “channel”. In code this is also called a “model”. I will be storing the model object in a private class field so that it can be accessed inside other methods of the module class:</p><pre>_channel.ExchangeDeclare(exchangeName, ExchangeType.Direct);<br>_channel.QueueDeclare(queueName, false, false, false, null);<br>_channel.QueueBind(queueName, exchangeName, routingKey, null);</pre><p>You can declare multiple queues and bind them all to the same exchange in this way. Be sure to take note of the routingKey, though — you’ll need this to determine which queues messages will be sent to later.</p><h3>Creating a message model</h3><p>Before you can send any messages, you will need to define a custom message model. This model will be serialised into the message that you send to RabbitMQ.</p><p>I use an interface for the model to allow me to have a base set of properties that must be set, allowing me to determine the type of message on the other end.</p><pre>public interface IRabbitMqMessageModel&lt;T&gt;<br>    where T : class<br>{<br>    Type ModelType { get; }<br>    T ModelData { get; set; }<br>}</pre><p>You also need an implementation of this interface. I use generics here to reduce code duplication:</p><pre>public class UserMessageModel&lt;T&gt; : IRabbitMqMessageModel&lt;T&gt;<br>        where T : class<br>{<br>    public Type ModelType =&gt; typeof(T);<br>    public T ModelData { get; set; }<br>}</pre><p>Next, you can create models that implement this interface for our three use-cases — Insert, Update and Delete.</p><pre>public class InsertUserModel<br>{<br>    public int UserID { get; set; }<br>    public string Username { get; set; }<br>    public string FullName { get; set; }<br>    public string Email { get; set; }<br>}<br>public class UpdateUserModel<br>{<br>    public int UserID { get; set; }<br>    public string Username { get; set; }<br>    public string FullName { get; set; }<br>    // No email - can&#39;t be changed in this integration<br>}<br>public class DeleteUserModel<br>{<br>    public int UserID { get; set; }<br>}</pre><h3>Sending a message</h3><p>In this example I’ll be using the Kentico UserInfo object. You can use this method with any Kentico Info object that has global events.</p><p>First you need to define some global event handlers within the OnInit method:</p><pre>UserInfo.TYPEINFO.Events.Insert.After += UserInsertOnAfter;<br>UserInfo.TYPEINFO.Events.Update.After += UserUpdateOnAfter;<br>UserInfo.TYPEINFO.Events.Delete.After += UserDeleteOnAfter;</pre><p>Next, create the methods themselves within the module class (insert shown here):</p><pre>private void UserInsertOnAfter (object sender, ObjectEventArgs e)<br>{</pre><pre>}</pre><p>Now you can fill out the integration details.</p><pre>private void UserInsertOnAfter(object sender, ObjectEventArgs e)<br>{<br>    var user = e.Object as UserInfo;<br>    if (user == null) return; // You might want to log this</pre><pre>    var messageModel = new UserMessageModel&lt;InsertUserModel&gt;();<br>    messageModel.ModelData = new InsertUserModel<br>    {<br>        UserID = user.UserID,<br>        Email = user.Email,<br>        FullName = user.FullName,<br>        Username = user.UserName<br>    };</pre><pre>    var message = Newtonsoft.Json.JsonConvert.SerializeObject(messageModel);</pre><pre>    byte[] messageBodyBytes = System.Text.Encoding.UTF8.GetBytes(message);<br>    _channel.BasicPublish(exchangeName, routingKey, null, messageBodyBytes);<br>}</pre><p>You should replace “exchangeName” and “routingKey” with the values required for your exchange and queue.</p><h3>Firing the integration</h3><p>Now that the code is all done, head into the CMS and create a new user. You should see a message appear in your RabbitMQ instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*z4gxrcGbjLFZf7ve.png" /></figure><p>Congratulations! You’ve published your first message from Kentico to your RabbitMQ instance.</p><p>By following the same process for each type of InfoObject you would like to export to your external system , you can easily send messages out from Kentico.</p><h3>Handling the message</h3><p>Your external system then needs to subscribe to the same message queues and handle the data in each message on the other end.</p><p>Alternatively, you could create a worker service (Windows service, Azure WebJob , AWS Lambda, etc) that would subscribe to the queue and deal with pushing the changes into your external system — in this way you can decouple the integration from Kentico and run it in a separate process.</p><h3>Summary</h3><p>RabbitMQ opens up the possibility of incredibly resilient integrations. Any messages that fail will get automatically retried. You can also configure your queues to pass messages that have failed too many times into a different queue so that they can be exported or retried in your development environment.</p><h3>Next time…</h3><p>In the next article of this series I’ll be looking at how to subscribe to message queues from within Kentico to pick up messages sent by an external system. The same principles can be applied to worker services or external systems that pick up the messages that you send out from Kentico.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c1cdb15b38a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/kentico-rabbitmq-integration-part-1-outbound-integration-7c1cdb15b38a">Kentico &amp; RabbitMQ Integration: Part 1 — Outbound Integration</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating custom redirects in Kentico]]></title>
            <link>https://medium.com/distinctionuk/creating-custom-redirects-in-kentico-ab0af0fd3196?source=rss-e6e979142015------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab0af0fd3196</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[kentico]]></category>
            <category><![CDATA[redirect]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Lee Conlin]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 14:49:38 GMT</pubDate>
            <atom:updated>2019-03-08T14:49:38.305Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether for products or for user profile pages, sometimes having a single page in the tree display data based on an identifier in the URL is the best way to go. Unfortunately, this means that you can’t use Kentico’s built-in alias paths to handle redirects relating to these pages. I find that also having a central location to manage redirect in the CMS makes things a little easier. It can be used to handle redirects from an old site to the client’s new Kentico site with little fuss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*yOlGtDm1U5OqO4Vf5BPI4Q.jpeg" /></figure><h3>The setup</h3><p>First, we need to set up a place to store the redirect rules. In a traditional web application, you might use URL Rewrite in IIS along with a rewrite map. However, this can lead to very large .config files if the client has many pages to redirect. Deploying these can be problematic too, and it can also lead to the site failing to load if the config file gets too big.</p><p>I also like to make the redirects accessible to the client via the CMS interface, should they need them.</p><p>To that end, we should create a custom table in Kentico.</p><p>In addition to the fields that Kentico will add (keep the defaults there) we will add the following fields to our custom table:</p><p><strong>FromPath </strong>Text(4000) <br><strong>ToPath </strong>Text(4000)</p><p>That’s all you will need in terms of setup… now we move to code.</p><h3>The handler</h3><p>We are going to use a <a href="https://docs.kentico.com/k11/custom-development/handling-global-events/reference-global-system-events">Kentico Global Event Handler</a> to intercept inbound requests and check for any matches in our custom table.</p><p>Create a new method in your project’s Module class…</p><pre>public static void ActionCustomRedirects(object sender, EventArgs e)  <br>{  <br>    if (HttpContext.Current == null)  <br>    {  <br>        return;  <br>    }  </pre><pre>    var request = HttpContext.Current.Request;  </pre><pre>    var item = CustomTableItemProvider.GetItems(&quot;CustomTable.CustomRedirects&quot;)  <br>        .Columns(&quot;ToPath&quot;)  <br>        .Where($&quot;&#39;{SqlHelper.EscapeQuotes(request.RawUrl)}&#39; LIKE FromPath&quot;)  <br>        .OrderByAscending(&quot;ItemOrder&quot;)  <br>        .TopN(1)  <br>        .FirstObject;  <br>  <br>    if (item != null)  <br>    {  <br>        URLHelper.RedirectPermanent(item.GetStringValue(&quot;ToPath&quot;, &quot;/404&quot;), SiteContext.CurrentSiteName);  <br>    }  <br>}</pre><p>Finally, we must wire-up the method above to the Kentico events system. In the OnIntit method of your Module simply add the following:</p><p>RequestEvents.Prepare.Execute += HttpHeadersHelper.ActionCustomRedirects;</p><p>This ensures that the redirects are checked before anything else happens on each request.</p><pre>RequestEvents.Prepare.Execute += HttpHeadersHelper.ActionCustomRedirects;</pre><p>In summary</p><p>This method of redirecting requests will be triggered at the start of each request and uses a reverse “LIKE” query so that we can use % wildcards in our “FromPath” entries.</p><p>Now in our custom table, we could create a FromPath of “/categories/%/123” and have this map to the ToPath of “/product/123”.</p><p>Since we order by ItemOrder and take the first match it allows us to have multiple redirects that get more specific the further down the order list they go.</p><p>Overall this method performs very well. Although it does add an extra SQL query to every request, in most cases it has a minimal impact on performance. If performance becomes an issue, you could further restrict it by checking the request URL and not doing redirects for certain types of requests (i.e. images and other static files).</p><h3>Taking it further</h3><p>This solution is pretty bare-bones in its basic form, and there could be many optimisations or extensions that could be made to improve or add functionality.</p><p>For example, you might add another column to determine the type of redirect to be performed. In this way, you could do a 301, a 302 or even perform some internal rewriting instead of a redirect.</p><p>If you have any other ideas on how to extend this or improve it further, let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab0af0fd3196" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distinctionuk/creating-custom-redirects-in-kentico-ab0af0fd3196">Creating custom redirects in Kentico</a> was originally published in <a href="https://medium.com/distinctionuk">Distinction</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>