<?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 Shlomi Elbaz on Medium]]></title>
        <description><![CDATA[Stories by Shlomi Elbaz on Medium]]></description>
        <link>https://medium.com/@shlomisderot?source=rss-34fd7cd52ac1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UVfgZ_VCdEyJpGCj.</url>
            <title>Stories by Shlomi Elbaz on Medium</title>
            <link>https://medium.com/@shlomisderot?source=rss-34fd7cd52ac1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 22:29:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shlomisderot/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[Apache Beam — Inject your pipeline dependencies through the PipelineOptions]]></title>
            <link>https://medium.com/@shlomisderot/apache-beam-inject-your-pipeline-dependencies-through-the-pipelineoptions-f9c356e37381?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9c356e37381</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[gcp-secret-manager]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Sat, 02 Sep 2023 21:15:13 GMT</pubDate>
            <atom:updated>2023-12-02T07:51:08.770Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache Beam — Inject the PipelineOptions through the Java Instance Factory</h3><p>I would like to share a challenge that I face with,</p><p>I am running dataflow services in three different GCP projects,</p><p>During the pipeline, I had to communicate with external services such as Redis, and GCP secrete manager,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*ASmYwjXlboBhS_MI0y_26Q.png" /></figure><p>In order to pull a secrete I need to provide the project-id to the secrete manager,</p><p>Since the dataflow service runs in three different projects, the project-id must be provided dynamically.</p><p>Instead of trying to pass the project-id in an ugly way, I found an easy and elegant way to do it by utilizing PipelineOptions,</p><p>The project-id is available on the PipelineOptions, and I rely on @Default.InstanceFactory in order to inject our Redis client.</p><p>The caveats in this approach are:<br>1. The injection of PipelineOptionsare available only forDoFn.@ProcessElementSo, in order to consume the PipelineOptionsyou must use ParDo<strong> </strong>for the pipeline apply.<br>2. The PipelineOptions<strong> </strong>limit is only inside the @ProcessElement scope.<br><strong>3. </strong>The Redis client is initialized in lazy mode — only when it is consumed.</p><p>So, let’s code,</p><p>The PipelineOptions looks like:</p><pre>public interface MyOptions extends PipelineOptions {<br>    @Validation.Required<br>    String getProjectId();<br>    void setProjectId(String projectId);<br><br>    @Default.InstanceFactory(RedisFactory.class)<br>    IRedisHelper getRedisClient();<br>    void setRedisClient(IRedisHelper client);<br><br>    @Default.Integer(6379)<br>    int getRedisPort();<br>    void setRedisPort(int port);<br><br>    @Validation.Required<br>    String getRedisHost();<br>    void setRedisHost(String host);<br>}</pre><p>Notice that, the <strong>getRedisClient()</strong> returns an object with the type of <strong>IRedisHelper </strong>and it annotates with @Default.InstanceFactory(RedisFactory.class)<strong>,</strong></p><p>The <strong>RedisFactory </strong>is responsible for initializing the Redis client, and it will be created only once per worker.</p><p>The RedisFactory looks like:</p><pre>public class RedisFactory implements DefaultValueFactory&lt;IRedisHelper&gt; {<br>    private IRedisHelper redis = null;<br>    @Override<br>    public IRedisHelper create(@NotNull PipelineOptions options) {<br>        try {<br>            if (redis == null) {<br>                try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) {<br><br>                    var myOptions = options.as(MyOptions.class);<br>                    var projectId = myOptions.getProjectId();<br>                    var secretnName  = SecretVersionName.of(projectId, &quot;PASSWORD&quot;, &quot;latest&quot;);<br>                    var secretVersion = client.getSecretVersion(secretnName);<br>                    var response = client.accessSecretVersion(secretVersion.getName());<br><br>                    var password = response.getPayload().getData().toStringUtf8();<br>                    var port = myOptions.getRedisPort();<br>                    var host = myOptions.getRedisHost();<br><br>                    redis = RedisHelper.of(host, port, password);<br>                }<br>            } else {<br>                redis = RedisHelper.of();<br>            }<br>            return redis;<br>        } catch (IOException e) {<br>            throw new RuntimeException(e);<br>        }<br>    }<br>}</pre><p>Our DoFn.@ProcessElement looks like the following:</p><pre>@ProcessElement<br>public void processElement(ProcessContext ctx, PipelineOptions options) {<br>  var myOptions = options.as(MyOptions.class);<br>  .<br>  .<br>  .<br>  var redis = myOptions.getRedisClient();<br>}</pre><p>The <strong>Redis </strong>client looks like the following:</p><pre>public interface IRedisHelper {<br>    byte[] get(String key) ;<br>    void set(String key, byte[] value) ;<br>    boolean exists(String key) ;<br>}</pre><pre>public class RedisHelper implements IRedisHelper, AutoCloseable {<br>    private static IRedisHelper instance = null;<br>    private static JedisPool jedisPool;<br><br>    private RedisHelper() {<br>        super();<br>    }<br><br>    public static IRedisHelper of() {<br>        if (instance == null) {<br>            instance = new RedisHelper();<br>        }<br>        return instance;<br>    }<br><br>    public static IRedisHelper of(String host, int port, String password) {<br>        JedisPoolConfig poolConfig = new JedisPoolConfig();<br>        jedisPool = new JedisPool(poolConfig, host, port, 2000, password);<br>        return of();<br>    }<br><br>    public byte[] get(String key) {<br>        try (Jedis jedis = jedisPool.getResource()) {<br>            return jedis.get(key).getBytes();<br>        } catch (Exception ex) {<br>            LOG.error(ex.getMessage());<br>        }<br>        return null;<br>    }<br><br>    public void set(String key, byte[] value) {<br>        try (Jedis jedis = jedisPool.getResource()) {<br>            var keyBytes = key.getBytes();<br><br>            jedis.set(keyBytes, value);<br>            jedis.expire(keyBytes, (long) Constants.REDIS_DOC_EXPIRY);<br>        } catch (Exception ex) {<br>            LOG.error(ex.getMessage());<br>        }<br>    }<br><br>    public boolean exists(String key) {<br>        try (Jedis jedis = jedisPool.getResource()) {<br>            var keyBytes = key.getBytes();<br>            return jedis.exists(keyBytes);<br>        } catch (Exception ex) {<br>            LOG.error(ex.getMessage());<br>        }<br>        return false;<br>    }<br><br>    @Override<br>    public void close() {<br>        jedisPool.close();<br>    }<br>}</pre><p>That’s it for now,<br>If something is not clear please comment,<br>Do not hesitate to contact me!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9c356e37381" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shrink your JSON payload using a fallback assignment with an undefined value instead of null]]></title>
            <link>https://medium.com/@shlomisderot/shrink-your-json-payload-by-fallback-assignment-with-an-undefined-value-instead-of-9845fe7d4537?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9845fe7d4537</guid>
            <category><![CDATA[payload]]></category>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[dto]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Fri, 01 Sep 2023 06:22:53 GMT</pubDate>
            <atom:updated>2024-05-23T06:57:42.549Z</atom:updated>
            <content:encoded><![CDATA[<p>When your services parse incoming HTTP messages payload through DTO objects, and the DTO contains optional fields, e.g.:</p><pre>address?: string | undefined;</pre><p>the <em>JSON.stringify</em> will automatically remove the field from the parsed JSON when the fields are set as undefined values, in contrast, when the fled is set as null the field is kept with a null value.</p><p>Assume your service gets an object of type IUser, and the incoming message looks like the following payload:</p><pre>{<br>  &quot;firstName&quot;: &quot;Shlomi&quot;,<br>  &quot;lastName&quot;: &quot;Elbaz&quot;,<br>  &quot;email&quot;: &quot;shlomi.elbaz@outlook.com&quot;<br>}</pre><p>When the ‘address’ field is set as an optional with <strong>null </strong>(or string empty) as a fallback assignment such as:</p><pre>const obj1 = {<br>  firstName: obj.firstName,<br>  lastName: obj.lastName,<br>  email: obj.email,<br>  address?: obj.address || null,<br>}</pre><p>After <em>JSON.stringify payload </em>will look like the following — the null value field still exists in the payload,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*DudKWlfgXXg0rWJV39WkzQ.png" /></figure><p>but if you use <strong>undefined </strong>as a fallback assignment such as:</p><pre>const obj2 = {<br>  firstName: obj.firstName,<br>  lastName: obj.lastName,<br>  email: obj.email,<br>  address: obj.address || undefined,<br>}</pre><p>After <em>JSON.stringify the address field </em>will remove from the payload,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*Et9eqmruS0GwXW7ZagzWXw.png" /></figure><p>That&#39;s it,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9845fe7d4537" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Beam — Windows, Late-Data, and Triggers.]]></title>
            <link>https://medium.com/@shlomisderot/apache-beam-windows-late-data-and-triggers-e2e856c502b9?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2e856c502b9</guid>
            <category><![CDATA[stream-late-data]]></category>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[windowing-technique]]></category>
            <category><![CDATA[data-processing-triggers]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Thu, 29 Jun 2023 04:43:16 GMT</pubDate>
            <atom:updated>2023-08-12T14:38:26.516Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache-Beam: Windows, Late-Data, and Triggers.</h3><p>Windows are a way of subdividing collections depending on the timestamp. when we aggregate elements, we might need to use the timestamp as part of an aggregation key,</p><p>The reason behind Windows is apart from being able to use the timestamp when we’re using streaming we need them,</p><p>In the case of bounded data (batch processing), we know when the data starts and when it ends, so we can aggregate everything from start to end without doing anything.</p><p>In the case of unbounded data (stream processing) i.e.: Kafka streams or Pub/Sub events, is infinite data, in that case, we don’t know when the data starts and when it ends, windows help us to “catch” incoming data over a stream and determine boundaries, then we can perform aggregations inside that boundaries!</p><p>We have four built-in windows in Apache Beam,</p><p>1. <strong>Fixed Window:</strong> <br>Represent a consistent duration, non-overlapping time interval in the data stream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYcRxFjgaxilhKVN7S4fHA.gif" /></figure><p>Fixed windows are helpful when we need to measure independent time events. The idea here is to split the data into pieces of time without any overlap of them.</p><pre>PCollection&lt;String&gt; items = ...;<br>PCollection&lt;String&gt; fixedWindowedItems = items.apply(<br>        Window.&lt;String&gt;into(FixedWindows.of(Duration.standardSeconds(60))));</pre><p><strong>2. Sliding Window:</strong> <br>Represents time intervals in the data stream, however, those intervals are created with a period, resulting in overlapping windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6aUFEqkbforJBU59-tJKSg.gif" /></figure><p>Sliding windows are useful for measuring trends.</p><pre> PCollection&lt;String&gt; items = ...;<br> PCollection&lt;String&gt; slidingWindowedItems = items.apply(<br>        Window.&lt;String&gt;into(SlidingWindows.of(Duration.standardSeconds(30)).every(Duration.standardSeconds(5))));</pre><p>3. <strong>Session Window:<br></strong>Represents time intervals in the data stream, however, those intervals are created with a period, resulting in overlapping windows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*39_BZN_J3YYvpRWjdRrU_w.gif" /></figure><p>The session window work on a key-value basis, data with the common key will capture in the same session window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEcoObNISJFrErESMIpGaw.png" /></figure><pre>PCollection&lt;String&gt; items = ...;<br>PCollection&lt;String&gt; sessionWindowedItems = items.apply(<br>        Window.&lt;String&gt;into(Sessions.withGapDuration(Duration.standardSeconds(600))));</pre><p>4. <strong>Global Window:</strong><br>Is the default window, and all the elements are assigned to it by default, If there’s a need to aggregate while using Global Window, we will do it by using triggers.</p><p>The way we can think about that kind of window is like it’s an infinite-size fixed window starting from minus infinite to plus infinite size, which is why all the elements belong to him.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDDC5NWzxTp87bKCDGkRNQ.png" /></figure><pre>PCollection&lt;String&gt; items = ...;<br>PCollection&lt;String&gt; batchItems = items.apply(<br>      Window.&lt;String&gt;into(new GlobalWindows()));</pre><h3>Pane</h3><p>A pane in Beam is one of the core concepts that is important to understand, when a trigger fires, it emits the current data elements of the window as a pane, therefore, a pane is when the trigger starts to observe the incoming data element until it met the trigger condition and it supposes to fire.</p><p>Since a trigger can fire multiple times, the accumulation mode determines whether the system <em>accumulates</em> the window panes as the trigger fires, or <em>discards</em> them.</p><p>Thus, “pane” is a kind of sub-window within or refers to a window that managed by the triggers</p><h3>Examples of panes</h3><p>Trigger settings - after pane element counts at least 3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDdts01jSTNvJsdErSHJpw.png" /><figcaption>AfterPane.elementCountAtLeast(3)</figcaption></figure><p>Trigger settings - after processing time past the first element in pane plus 10 minutes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-jBnc_w09JuKYWxaXjr8A.png" /><figcaption>AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardMinutes(10))</figcaption></figure><h3>Late Data and Triggers</h3><p><strong>Core Concepts</strong></p><p><strong>— Event Time:</strong> when a data event occurs, determined by the timestamp on the data element itself. Windows uses this to determine which window the element belong to.</p><p>— <strong>Processing Time: </strong>when a data element gets processed at any stage in the pipeline — determined by the clock on the processing system.</p><p>— <strong>Watermark:</strong> refer to the difference between a maximum event and processing time. different systems may track it differently.</p><p>For example, if I called to order a pizza, this is the <strong>event-time</strong>, and the moment I get the pizza, this is the <strong>processing time</strong>, the difference between those is the <strong>watermark </strong>for this particular element, but the measurement of the <strong>watermark </strong>is taking all the elements and taking the maximum difference between the <strong>event-time</strong> to the <strong>processing time</strong>, e.g.: A maximum time to order pizza is 10 minutes.</p><p>— <strong>Trigger:</strong> determine when to emit the aggregate results for each window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*DV4TZvfer7Qti19iIdvjog.png" /></figure><h3>Late Data</h3><p>Since data may come later than its event time, we need may guarantee completeness for those elements when aggregating in our window.</p><p>Beam allows us to set a maximum lateness to our windows.</p><p>For example, if we set a 1hr fixed window, and allow 15min late data, all the elements within 1:15hr will be accepted and those beyond this time will be dropped.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gl59iwzhYg-RQKufuk-jYQ.png" /></figure><p><strong>Accumulation Modes<br></strong>When we specify a <strong>trigger </strong>or allow <strong>late data</strong>, we must set Windows <strong>accumulation mode.</strong> When the trigger fires, it emits the current contents of the window pane, The accumulation mode determines whether the system accumulates the window panes or discards them.</p><p>— <strong>Accumulating</strong>: keeps the previous elements that were already fired.<br> — <strong>Discarding</strong>: discard the previous elements and only fires the new ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*LgB5l7PZqC2Whp2FJwvJOA.png" /></figure><p><strong>Accumulating mode</strong></p><p>If our trigger is set to accumulating mode, the trigger emits the following values each time it fires. Keep in mind that the trigger fires every time three elements arrive:</p><p>First trigger firing: [5, 8, 3]<br>Second trigger firing: [5, 8, 3, 15, 19, 23]<br>Third trigger firing: [5, 8, 3, 15, 19, 23, 9, 13, 10]</p><p><strong>Discarding mode</strong></p><p>If our trigger is set to discarding mode, the trigger emits the following values on each firing:</p><p>First trigger firing: [5, 8, 3]<br>Second trigger firing: [15, 19, 23]<br>Third trigger firing: [9, 13, 10]</p><p>From the following figure, late data after the window is closed is accumulated in <strong>Accumulation Mode</strong>, while in <strong>Discarding Mode </strong>the previous elements are dropped.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*Gr0IkKtNvVBt_zSSA2dO0w.png" /><figcaption><strong>Accumulation Mode</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*rGxVW59hLM8WUsACmcxWAQ.png" /><figcaption><strong>Discarding Mode</strong></figcaption></figure><h3>Triggers</h3><p>Beam uses <strong>triggers </strong>to determine when to emit the aggregated results of each window — referred to as a pane.</p><p>By default, Beam emits the results when the window is closed, but we can modify the trigger to emit early and late results, These allow us to control the data and balance between <strong>completeness, latency,</strong> and <strong>cost</strong></p><p><strong>Trigger Types</strong></p><p><strong>Event time triggers:</strong> These triggers operate on event time, as included by the timestamp on each data element, this is also the Beam default trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*hxHZZIyXns1GsKWxeSzuvQ.png" /></figure><p><strong>Processing time triggers:</strong> These triggers operate on the processing time — the time when the data element is processed at any given stage in the pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*AttFOLjDUrmJYmCpnQpbxQ.png" /></figure><p><strong>Data-driven triggers:</strong> These triggers operate by examining the data as it arrives in each window, and firing when that data meets a certain property. Currently, data-driven triggers only support firing after a certain number of data elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*2apWfb5hhhs4FOc_4_Ai1g.png" /></figure><p><strong>Composite triggers:</strong> These triggers combine multiple triggers in various ways. there are four types of composite triggers:<br> — <strong>Repeatedly Forever:</strong> Any time the trigger’s conditions are met, it causes a window to emit results and then resets and starts over.</p><p>—<strong> After Each:</strong> Emits in a specific sequence.</p><p>— <strong>After First:</strong> Emits when one of the conditions is met.</p><p>— <strong>After All:</strong> Emits when all the conditions are met.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*6VtyDVlDL50jPDF1d5sjIQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2e856c502b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Beam — launching a single service in a multiform execution mode]]></title>
            <link>https://medium.com/@shlomisderot/apache-beam-launching-a-single-service-in-a-multiform-execution-mode-6d8d92c9b240?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d8d92c9b240</guid>
            <category><![CDATA[streaming-processing]]></category>
            <category><![CDATA[batch-processing]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[apache-beam]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Fri, 12 May 2023 20:03:14 GMT</pubDate>
            <atom:updated>2023-05-16T13:15:36.633Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache-Beam: <em>launching a single service</em> in a multiform execution mode</h3><p>As part of the work, we handle a campaign distribution, we handle several types of campaigns, and all of them are triggered by Pub/Sub events.</p><p>Some Pub/Sub events contain paths to Avro files that locate in a GCS bucket and during the pipeline processing, we access those files by using the <a href="https://beam.apache.org/releases/javadoc/2.3.0/org/apache/beam/sdk/io/AvroIO.html"><strong><em>Apache Beam AvroIO</em></strong></a> framework.</p><p>Over time we have noticed that when it comes to campaigns with a large number of recipients, we found an issue in terms of processing time, at the point where we turn to read the Avro files in the pipeline, and also when reading massive data from Avro files consumes intensive CPU which is a pretty expensive cost in a streaming mode.</p><p>So we have come to a decision to combine batch processing when it comes to large campaigns and keep streaming processing for small campaigns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qstA1qBqFwqwarLtFrtTSw.png" /><figcaption>single dataflow service in a multiform execution mode</figcaption></figure><p>The decision of whether to run the job in a batch or streaming mode is determined by the invoker process (Node.js) and it’s affected by the Number-Of-Recipients.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4f4710e715d6ffe220ebbb5b3044ed5/href">https://medium.com/media/b4f4710e715d6ffe220ebbb5b3044ed5/href</a></iframe><p>For the streaming mode, we launch the service by using <strong>gcloude </strong>CLI command and provide a parameter called “sourceSubscription”, soon as the service starts, it observes the Pub/Sub subscription and pulls every incoming event,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/840e13979d767f808c8cd282743b15ef/href">https://medium.com/media/840e13979d767f808c8cd282743b15ef/href</a></iframe><p>And for batch mode, we launch a dataflow service separately for each campaign by using gRpc, we provide a “payload” parameter, which contains the same payload as we pass by the Pub/Sub event,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/81eb7122dcb30a302b596e1b5035e9e1/href">https://medium.com/media/81eb7122dcb30a302b596e1b5035e9e1/href</a></iframe><p>During the job launch, we check by <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html"><strong><em>Optional</em></strong></a> Java object if a parameter “sourceSubscription” that represents the Pub/Sub subscription is provided, and then the service starts to observe it by <a href="https://beam.apache.org/releases/javadoc/2.3.0/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.html"><strong><em>Apache Beam PubsubIO</em></strong></a>, this actually makes the service run as a streaming mode,</p><p>And as for batch mode, we check if a parameter “payload” is provided and then create a <strong><em>PubsubMessage</em></strong>,</p><p>Both of the pipeline branches merged into the next pipeline apply handler (line 23 from the following code).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/591fece10e75c8e2992eb30f9962bdd5/href">https://medium.com/media/591fece10e75c8e2992eb30f9962bdd5/href</a></iframe><p>Of course, we could separate the service into two different dataflow services, the benefits of running one dataflow service in a multiform execution mode are: avoiding duplications in a term of code maintenance, and raising the code re-use and decoupling.</p><p>Thats is!</p><p>If you have any questions, please don’t hesitate to contact me at <a href="/service/mailto: shlomi.elbaz@outlook.com">shlomi.elbaz@outlook.com</a> or write a comment</p><p>Also, please join my followers and visit my <a href="https://www.linkedin.com/in/shlomi-elbaz/">LinkedIn </a>and <a href="https://github.com/shlomielbaz">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d8d92c9b240" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Code — Split Your .Net-Core App Into Logical Tires]]></title>
            <link>https://medium.com/@shlomisderot/clean-code-split-your-net-core-app-into-logical-tires-f7de6b6bdd6c?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7de6b6bdd6c</guid>
            <category><![CDATA[architectural-design]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[solid]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Tue, 09 May 2023 07:40:37 GMT</pubDate>
            <atom:updated>2023-05-18T03:45:15.872Z</atom:updated>
            <content:encoded><![CDATA[<h3>Clean Code — Split Your .Net-Core App Into Logical Tires</h3><p>This is the first article in a series of “clean code”, this is a basic example but very important, it will form the basis of all other next examples,</p><p>The source code is located in the <a href="https://github.com/shlomielbaz/employee-management">GitHub repo</a>, I took the advantage of .Net Core and OOP offers such as built-in DI container, Decorator, Interface segregation, Repository, Unit-of-Work, etc.</p><p>So let’s start…</p><p>Usually, when I start a new project I am always guided by the idea of a <a href="https://www.ibm.com/topics/three-tier-architecture">three-tier architecture</a>, it&#39;s fantastic, it leads you to organize your code well and clean in enterprise projects …</p><figure><img alt="Three-tier architecture overview" src="https://cdn-images-1.medium.com/max/893/1*0oB7fp4aDu5nhZGGPjngMA.png" /><figcaption>Three-tier architecture overview</figcaption></figure><h4>The Domain Teir:</h4><p>A project of class library type can contain all the business models, Entities, and other abstractions, in the code project, the domain tier represented by <strong><em>EM.Domain</em></strong> class library.</p><h4>The Data Teir:</h4><p>A project of class library type can contain the DAL, Façade, and other DB materials, the data tier represented by <strong><em>EM.Data</em></strong> class library and it holds the <a href="https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=netcore-cli">EntityFramework</a> DB context, generic Repository, and migration scripts.</p><h4>The Presentation Teir:</h4><p>A Node.js project type contains the Angular UI materials for the application. All style files &amp; components build up to form the entire UI experience. All components will use the whole logic from the data and core in this layer. the presentation tier represented by <strong><em>EM.Site </em></strong>and carries all the client stuff.</p><p>But…</p><p>In my point of view, we can divide the application into more logical separations, for instance, the presentation tier can be divided into two parts: the UI itself and a “message layer” where the UI “speaks” with the server through controllers, so then;</p><h4>The Message Teir:</h4><p>A project of class library type is represented by <strong><em>EM.Api </em></strong>class library.</p><p>Another part that can be divided is the part in the middle between the outside world to the business logic (domain), this part is a kind of mediator, that is responsible to transform incoming messages (view-models) to/from domain entities, so then;</p><h4>The Transformation Teir:</h4><p>A project of class library type is represented by <strong><em>EM.Services </em></strong>class library.</p><p>I call it “Transformation” because, when the end-user performs a login use-case, the end-user actually invokes an HTTP request that containing a username and password, which is part of a User entity, that kind of abstraction is represented by ViewModel’s,</p><p>So, the login use case is represented by <em>UserLoginViewModel.</em></p><p>The schema of the “new” separation architecture looks like the following figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WXdwJivsR6S1Cs3bUxfbkQ.png" /></figure><h3>The Project Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*0z3N7if6l2VQXCzGIGk4Yw.png" /></figure><p>You can find more information about the project parts and how to run it in the project <a href="https://github.com/shlomielbaz/employee-management">README.md</a> located on GitHub.</p><h4>Naming Conventions:</h4><p>I find out that it is good practice to give a naming convention to the different parts of the app, I took advantage of C# attributes to do it, for the database fields I use <a href="https://www.freecodecamp.org/news/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-whats-the-difference/#snake-case">snake-case</a> while for the incoming/outgoing messages (JSON) I use <a href="https://www.freecodecamp.org/news/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-whats-the-difference/#camel-case">camel-case</a>, and the app I use <a href="https://www.freecodecamp.org/news/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-whats-the-difference/#pascal-case">pascal-case</a> for C# code.</p><p>The following is an example of property naming for the Employee entity and Employee view model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e3e9cd03dd7cfd51d3e204c4adea01a/href">https://medium.com/media/0e3e9cd03dd7cfd51d3e204c4adea01a/href</a></iframe><h3>Lazy Coding:</h3><p>Usually, the app services implement CRUD operations, and for that, I create the <em>ICrudService </em>interface to force implementing CRUDs, but on the other hand, I needed to create a specific interface for each service in order to be able to inject a service instance, so, in order to avoid duplicate code I took the advantage of C# interface inheritance and C# generics, so I could unifying the service operations and specify an interface for each service.</p><p>The following code shows the abstraction of <em>EmployeesService:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fa3db8a50bc9e9488a3e371a322950e/href">https://medium.com/media/6fa3db8a50bc9e9488a3e371a322950e/href</a></iframe><p>This is a very basic clean code architecture, next, I will dive deeper into clean code architectures so please add me to your following list,</p><p>also, you are welcome to visit other GitHub repositories such as o<a href="https://github.com/shlomielbaz/dotnet-template-orchestra">rchestrate .NET core apps with docker-compose</a></p><p>Do not hesitate to contact me!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7de6b6bdd6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache-Beam: Inputs to Flatten had incompatible triggers error]]></title>
            <link>https://medium.com/@shlomisderot/apache-beam-flatten-had-incompatible-triggers-error-e6c160888dfe?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6c160888dfe</guid>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[etl-pipeline]]></category>
            <category><![CDATA[apache-beam]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Tue, 02 May 2023 19:04:21 GMT</pubDate>
            <atom:updated>2023-05-03T08:17:00.089Z</atom:updated>
            <content:encoded><![CDATA[<p>During my Apache-Beam pipeline, I encountered the following error: <strong>SEVERE: Main error stackTrace Inputs to Flatten had incompatible triggers: Never.NeverTrigger, DefaultTrigger</strong></p><p>It turns out that PCollection with the same item type and the same coder, but different windowing settings and triggering effects on the compatibility while trying to merge pipeline branches.</p><p>I will explain,</p><p>My pipeline contains several branches that handle transformation and generate the same item type of <strong>PCollection&lt;Row&gt;</strong> but they use different session windows <strong>withGapDuration </strong>and different triggering when I intend to merge them with <strong>Flatten.pCollections(), </strong>it fails with an “incompatible” reason.</p><p>From the following code block, <em>result1 </em>and <em>result2</em> represent two different branches in the pipeline, notice that each branch uses a different windowing setting, they both return the same <strong>PCollection&lt;Row&gt;</strong> with the same coder, but when I try to merge them by <strong>PCollectionList.of(result1).and(result2) .apply(Flatten.pCollections()); </strong>its throws “<strong>Inputs to Flatten had incompatible triggers: Never.NeverTrigger, DefaultTrigger</strong>”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e31d289d9f8a93c769be0ac0b9842cf/href">https://medium.com/media/8e31d289d9f8a93c769be0ac0b9842cf/href</a></iframe><p>Thats it!</p><p>If you have a question, please write a comment</p><p>Also, please join my followers and visit my <a href="https://www.linkedin.com/in/shlomi-elbaz/">LinkedIn </a>and <a href="https://github.com/shlomielbaz">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6c160888dfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript — Parse URL-encoded string into JSON in ONE line of code]]></title>
            <link>https://medium.com/@shlomisderot/javascript-parse-url-encoded-string-into-json-in-one-line-of-code-f1cbed4ba09c?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1cbed4ba09c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[package]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 08:39:47 GMT</pubDate>
            <atom:updated>2023-03-22T08:39:47.101Z</atom:updated>
            <content:encoded><![CDATA[<h3>Javascript — Parse URL-encoded string into JSON in ONE line of code</h3><p>The source code can be found at: <a href="https://github.com/shlomielbaz/url-encoded">https://github.com/shlomielbaz/url-encoded</a></p><p>I want to share with you some regex experiences that I had to deal with…</p><p>From security aspects, the internet transforms every message into URL-encoded,</p><p>I look for some Node libraries to do that, but those that I found were quite messy and contained too many lines of code or they didn’t do the job so, I decided to do it by myself, surprisingly, I replaced all the “libraries” into one line of code thanks to regular expression…</p><p>the motivation is to convert the urlencoded string (‘application/x-www-form-urlencoded’) into a valid JSON string in order to use JSON.parse function.</p><p>I got the following string:</p><pre>protocol=echo-protocol&amp;topic=assets%3Aremove&amp;data=%7B%22uid%22%3A%22bd17ecad-fc2e-4568-ae21-ad08ddf48b59%22%2C%22gid%22%3A%221a71d70d-bc5b-46f1-b6ec-16776b6285eb%22%2C%22data%22%3A%7B%22id%22%3A%225c1116adc9c31f74efcdafbe%22%7D%7D</pre><p>And I needed to convert it to valid JSON, something like:</p><pre>{<br>  data: {<br>    product_id: &quot;5c1116adc9c31f74efcdb022&quot;,<br>    group_id: &quot;1a71d70d-bc5b-46f1-b6ec-16776b6285eb&quot;,<br>    user_id: &quot;bd17ecad-fc2e-4568-ae21-ad08ddf48b59&quot;<br>  },<br>  protocol: &quot;echo-protocol&quot;,<br>  topic: &quot;assets:remove&quot;<br>}</pre><p>The solution:</p><pre>JSON.parse(decodeURIComponent(&#39;url encoded string&#39;).replace(/=([^&amp;]+)\&amp;/g, &quot;=\&quot;$1\&quot;,\n\r&quot;).replace(/(^|\r)([^=]+)=/g, &quot;\&quot;$2\&quot;:&quot;).replace(/^/, &#39;{&#39;).replace(/$/, &#39;}&#39;))</pre><p>Explanation:</p><ul><li>use the javascript decodeURIComponent function in order to decode the URL-encoded string.</li><li>.replace(/=([^&amp;]+)\&amp;/g, “=\”$1\”,\n\r”) — replace all ampersands, with line feed and carriage return, notice that I’m using global (g) regexp modifier.</li><li>.replace(/(^|\r)([^=]+)=/g, “\”$2\”:”) — take all words after starting line (^) or carriage return (\r) until the equal sign and put it inside quotation marks and add colons (:) right after, again, notice that I’m using global (g) regexp modifier.</li><li>.replace(/^/, ‘{‘) — replace the starting string (^) with open curly brackets.</li><li>.replace(/$/, ‘}’) — replace the end of string ($) with close curly brackets.</li><li>run JSON.parse on the result</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1cbed4ba09c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Beam — Centerlize the pipeline error handling]]></title>
            <link>https://medium.com/@shlomisderot/apache-beam-centerlize-the-pipeline-error-handling-5872a0e514d7?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5872a0e514d7</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[dataflow]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[apache-beam]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Sun, 19 Mar 2023 15:18:36 GMT</pubDate>
            <atom:updated>2023-08-12T14:40:08.425Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache-Beam: Centralize the pipelines error handling</h3><p>In pipeline processing, it’s quite a headache to handle errors and catch exceptions, it is not something that can be achieved with traditional try-and-catch blocks, you need special preparation for that,</p><p>Apache-Beam provides a built-in error-handling mechanism and there are some other third-party libraries for that purpose</p><p>In the article “<a href="https://medium.com/google-cloud/error-handling-with-apache-beam-presentation-of-asgarde-ce5e5dfb2d74">Error handling with Apache Beam: presentation of Asgarde</a>” <a href="https://medium.com/@mazlum.tosun?source=user_profile-------------------------------------">Mazlum Tosun</a> suggests an elegant way to handle errors by using the <a href="https://medium.com/google-cloud/error-handling-with-apache-beam-presentation-of-asgarde-ce5e5dfb2d74">Asgarde</a> library — that he owned,</p><p>I would like to suggest a more systemic solution, a high-level error handling system utilizing an <a href="https://en.wikipedia.org/wiki/Event-driven_architecture">event-driven architecture</a>, where multiple dataflow services are involved and we centralize the handling errors across a cluster,</p><p>Each of the services within the cluster will emit errors that happened in the pipeline to the same Pub/Sub topic, and then a dataflow service will observe the incoming messages and spread it to whatever we want, for example, we can send it to the API endpoint, or save it in a persistence DB’s or send it to monitoring systems such as DATADOG, Grafana, GCP Loggs, etc.</p><p>Here is a graphical view of the suggestion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*LCPf8NX73r_VCrDPRTC0XQ.png" /></figure><p>Let&#39;s code...</p><p>Each one of the dataflow services in your cluster will implement the following code,</p><p>First of all, we use an object <em>Failure</em> for catching all errors,</p><ol><li>We declare <em>PCollectionList</em> as a hamster so that we can collect the errors all over the pipeline:</li></ol><pre>var FAILURES = new ArrayList&lt;PCollection&lt;Failure&gt;&gt;();</pre><p>2. At each stage in the pipeline where we can catch an error we use <em>exceptionsVia</em> for hoarding the error:</p><pre>pipeline.apply(&quot;Pipeline Stage&quot;,<br>  MapElements.via(...)<br>    .exceptionsInto(TypeDescriptor.of(Failure.class))<br>    .exceptionsVia(ex -&gt; Failure.from(&quot;pipeline failed&quot;, ex)));</pre><p>3. Add the failures to our hamster:</p><pre>FAILURES.add(pipeline.failures());</pre><p>4. Transform the <em>PCollectionList</em> into <em>PCollection</em> and pass it to the emitter:</p><pre>// Handle failures<br>PCollectionList.of(FAILURES)<br>  .apply(&quot;Flatten Failures&quot;, Flatten.pCollections())<br>  .apply(&quot;Publish to Pub/Sub&quot;, PubsubIO.writeMessages().to(topic));</pre><p>When an error occurs, it is collected and sent to a Pub/Sub topic, and all the errors from all services gather into one place, soon the event arrives at the target, and you can do whatever you want!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5872a0e514d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript — Scope, Hoisting, and Closure]]></title>
            <link>https://medium.com/@shlomisderot/javascript-scope-hoisting-and-closure-28c93ce5320b?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/28c93ce5320b</guid>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Mon, 28 Nov 2022 09:30:34 GMT</pubDate>
            <atom:updated>2023-05-13T04:03:54.041Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript — Lexical Scope, Hoisting, and Closure</h3><p>I tackled in post with a title: <a href="http://dmitry.baranovskiy.com/post/91403200">“So, you think you know JavaScript?”</a> the post was written by <a href="http://dmitry.baranovskiy.com/">Dmitry Baranovskiy</a> — the creator of <a href="http://snapsvg.io/">Snap.SVG</a> <a href="http://raphaeljs.com/">Raphaël</a> JavaScript libraries.</p><p>Dmitry challenges us with 5 simple Javascript questions in order to test our understanding of JavaScript.</p><ol><li>What alerts the following scripts?</li></ol><pre>if (!(&quot;a&quot; in window)) {<br>    var a = 1;<br>}<br>alert(a);</pre><p>The above script will alert “undefined”…</p><p>Explanation:</p><p>Here is an example of <em>static scope</em> where the ‘a’ variable is accessible only in the ‘if’ block, the hoisting is limited to that block,</p><p>In the ‘if’ statement we check if “a” is not declared in the window object, and then ‘a variable is declared inside the ‘if’ block, namely, “a” variable scoped to the “if” block and it is not accessible out of the ‘if’ block.</p><p>2. What alerts the following scripts?</p><pre>var a = 1,<br>    b = function a(x) {<br>        x &amp;&amp; a(--x);<br>    };</pre><pre>alert(a);</pre><p>The above script will alert “1”…</p><p>Explanation:</p><p>Allegedly, we have two items with the same name “a” but, since we assigned object (function) “a” into variable “b” then variable “b” holding the reference to the object, in fact, there is no meaning to the “a” name of the function, in practice, we could assign to “b” an anonymous function, like this: var b = function(x) { … }</p><p>3. What alerts the following scripts?</p><pre>function a(x) {<br>    return x * 2;<br>}<br>var a;<br>alert(a);</pre><p>The above script throw error: Identifier ‘a’ has already been declared…</p><p>In contrast to the previous script, here we declare two items with the name/reference “a”</p><p>4. What alerts the following scripts?</p><pre>function b(x, y, a) {<br>    arguments[2] = 10;<br>    alert(a);<br>}<br>b(1, 2, 3);</pre><p>The above script will alert “10”…</p><p>Explanation:</p><p>In Javascript, the arguments object is a special construct available inside all function calls. It represents the list of arguments that were passed in when invoking the function.</p><p>From the above script, “a” argument locate in index 2 in the arguments array which is reset to value 10 inside the function.</p><p>5. What alerts the following scripts?</p><pre>function a() {<br>    alert(this);<br>}<br>a.call(null);</pre><p>The above script will alert “[object Window]”…</p><p>The function.call(…) binds the context of the first parameter to the function context, so, “this” refers to the parameter “null” which is an object value.</p><p>that’s it!</p><p>Your welcome to write your comment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28c93ce5320b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create GCP Pub/Sub Subscription with specific credentials]]></title>
            <link>https://medium.com/@shlomisderot/create-gcp-pub-sub-subscription-with-specific-credentials-20dfe86f2c04?source=rss-34fd7cd52ac1------2</link>
            <guid isPermaLink="false">https://medium.com/p/20dfe86f2c04</guid>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[pub-sub-subscription]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Shlomi Elbaz]]></dc:creator>
            <pubDate>Fri, 27 May 2022 04:19:50 GMT</pubDate>
            <atom:updated>2022-05-27T06:42:47.027Z</atom:updated>
            <content:encoded><![CDATA[<p>I had a struggle with creating a Pub/Sub subscription that I would like to share with you.</p><p>I am using C# Google.Cloud.PubSub.V1 in .NET Framework 4.8.</p><p>I am also using a <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity">GCP workload identity</a> on my local machine (DEV) which allows me to use <em>SubscriberServiceApiClient </em>for creating Pub/Sub subscriptions without any problem because it relies on the default <em>GoogleCredential</em>, but in the production, I had to use a specific service account key.</p><p>It turns out that, all Google cloud examples for creating Pub/Sub subscriptions rely on <em>SubscriberServiceApiClient </em>using the default <em>GoogleCredential </em>so my struggle was how to use it with a specific service account key!</p><p>The solution found in the use of <em>SubscriberServiceApiClientBuilder </em>allows for building a <em>SubscriberServiceApiClient with a specific key.</em></p><p>The code example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d2fc4b38d8855b1a3702a44ffe6345c/href">https://medium.com/media/2d2fc4b38d8855b1a3702a44ffe6345c/href</a></iframe><p>That&#39;s all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20dfe86f2c04" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>